与CustomAction相关的Wix错误1721
我有下列症状与CustomAction相关的Wix错误1721,wix,custom-action,windowserror,Wix,Custom Action,Windowserror,我有下列症状 <Binary Id='ManualsBat' SourceFile='bin\Debug\test.bat' /> <CustomAction Id="manuals" BinaryKey="ManualsBat" ExeCommand="[SourceDir]Manuals "[Agent]Manuals"" Execute="immediate" Return="check" /> 它的基本
<Binary Id='ManualsBat' SourceFile='bin\Debug\test.bat' />
<CustomAction
Id="manuals"
BinaryKey="ManualsBat"
ExeCommand="[SourceDir]Manuals "[Agent]Manuals""
Execute="immediate"
Return="check" />
它的基本意图是,当安装程序运行时,需要执行批处理文件。批处理文件必须创建一个新目录“[Agent]Manuals”,并且必须将所有文件从[SourceDir]Manuals复制到[Agent]Manuals
当我构建.wxs时,它不会给出任何错误,但当我运行.msi时,它会在日志文件中抱怨以下问题
错误1721。此Windows Installer软件包有问题。无法运行完成此安装所需的程序。请与您的支持人员或软件包供应商联系。操作:manuals,位置:C:\Windows\Installer\MSI1F50.tmp,命令:C:\dev\CD\Agent\pd\components\link\source\link\Installer\WiX\WiX\bin\Debug\manuals“D:\Cam\city\Agent\manuals
有没有人遇到过这种错误。如果有人能帮我解决这一问题,那就太好了。您的自定义操作很可能需要管理员权限。请尝试将
执行属性设置为延迟,并将模拟设置为否。请注意,这些选项要求操作是计划在InstallFinalize标准操作之后执行。您通常需要调用cmd/c foo.bat(或Win9x上的命令)来处理.bat文件
但是,我永远不会在我的安装程序中这样做。这违反了Windows Installer的总体设计。MSI是一种事务性、声明性编程语言。注入进程外过程代码会大大增加失败的可能性(正如您所经历的那样),更糟糕的是,它会破坏MSI的事务性优势
例如,如果创建文件夹并复制文件,则在回滚期间不会撤消该文件夹,在卸载期间也不会删除该文件夹。相反,您应该使用内置的Windows Installer功能(CreateFolder和CopyFile元素)来实现目标
在真正需要自定义操作的情况下(在您的示例中,您只是用一个劣质的解决方案重新设计了轮子),它们应该使用健壮的语言进行设计,并保持声明性(数据驱动)和事务性设计,同时尊重MSI使用的安全模型。引号中可能存在问题。ExeCommand引号中的更改。
试试这个:
<Binary Id='ManualsBat' SourceFile='bin\Debug\test.bat' />
<CustomAction
Id="manuals"
BinaryKey="ManualsBat"
ExeCommand='"[SourceDir]Manuals" "[Agent]Manuals"'
Execute="deferred"
Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="manuals" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
未安装
在='InstallFinalize'之后添加时出错:“…是脚本中的自定义操作。它必须在InstallExecuteSequence表中的InstallInitialize操作和InstallFinalize操作之间按顺序排列“您发现了吗?我在安装自定义操作驱动程序时遇到了类似的问题。
<Binary Id='ManualsBat' SourceFile='bin\Debug\test.bat' />
<CustomAction
Id="manuals"
BinaryKey="ManualsBat"
ExeCommand='"[SourceDir]Manuals" "[Agent]Manuals"'
Execute="deferred"
Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="manuals" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>