【发布时间】:2012-03-13 21:38:36
【问题描述】:
我正在尝试在我的 WiX MSI 设置项目中以自定义操作运行用 C# .NET 2.0 编写的控制台应用程序,如下所示:
<CustomAction Id="INSTALL_TEXT" Impersonate="yes" Return="check" Execute="immediate" BinaryKey="TextCreator.exe" ExeCommand="C:\test.txt -i"/>
<CustomAction Id="UNINSTALL_TEXT" Impersonate="yes" Return="check" Execute="immediate" BinaryKey="TextCreator.exe" ExeCommand="C:\test.txt -u"/>
<Binary Id="TextCreator.exe" SourceFile="C:\MyInstaller\Test\Tools\TextCreator.exe"/>
<InstallExecuteSequence>
<Custom Action="INSTALL_TEXT" After="InstallFiles">NOT Installed AND NOT PATCH</Custom>
<Custom Action="UNINSTALL_TEXT" After="RemoveFiles">Installed AND REMOVE="ALL"</Custom>
</InstallExecuteSequence>
但我总是在日志中收到一条错误消息:
MSI (s) (7C:C0) [14:03:01:026]: 注意: 1: 1721 2: INSTALL_TEXT 3: C:\Windows\Installer\MSI9938.tmp 4: C:\test.txt -i
错误 1721。此 Windows 安装程序包有问题。无法运行完成此安装所需的程序。请联系您的支持人员或软件包供应商。操作:INSTALL_TEXT,位置:C:\Windows\Installer\MSI9938.tmp,命令:C:\test.txt -i
MSI (s) (7C:C0) [14:03:07:374]:产品:Text Creator Console App -- 错误 1721。此 Windows Installer 程序包存在问题。无法运行完成此安装所需的程序。请联系您的支持人员或软件包供应商。操作:INSTALL_TEXT,位置:C:\Windows\Installer\MSI9938.tmp,命令:C:\test.txt -i
行动于 14:03:07 结束:INSTALL_TEXT。返回值 3。
我在我的应用程序中嵌入了一个清单,以便以管理权限运行:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
当我从命令行运行安装程序时,控制台提示符已经以管理权限启动,安装和卸载都可以正常工作!但是,当我使用双击启动 MSI 时,如果我想以管理权限运行,系统会要求我运行安装(在进度条继续之前)。然后我的设置中止,并显示上面 LOG 中提供的错误消息。
是什么导致了这个问题?我在我的项目中使用带有 MSI 2.0 的 WiX 3.5.2519.0。我的设置在 Windows 7 Professional (x64) 上运行。我安装了从 2.0、3.0、3.5 到 4.0 的所有框架!
编辑:在安装了 .NET Framework 2.0 的 Windows XP 上,一切正常!
解决方案:
<CustomAction Id="QtExecInstallText" Impersonate="no" Return="check" Execute="deferred" BinaryKey="TextCreator.exe" ExeCommand="C:\test.txt -i"/>
<CustomAction Id="QtExecUninstallText" Impersonate="no" Return="check" Execute="deferred" BinaryKey="TextCreator.exe" ExeCommand="C:\test.txt -u"/>
<Binary Id="TextCreator.exe" SourceFile="C:\MyInstaller\Test\Tools\TextCreator.exe"/>
<InstallExecuteSequence>
<Custom Action="QtExecInstallText" After="InstallFiles">NOT Installed AND NOT PATCH</Custom>
<Custom Action="QtExecUninstallText" After="RemoveFiles">Installed AND REMOVE="ALL"</Custom>
</InstallExecuteSequence>
=> 将 pass -ext "%WIX%\bin\WixUtilExtension.dll" 链接到 light.exe 时!
【问题讨论】:
标签: wix windows-installer custom-action