我有一个带有一系列软件包的 WiX Burn 安装。
更新以 /passive 模式运行,无需用户交互。
最后一个包仅在更新时运行,唯一目的是运行可执行文件,它使用以下代码执行此操作。
<!-- Quiet Execution Deferred execution with qtExec-->
<Property Id="QtExecDeferredExample" Value=""C:\Program Files (x86)\Acme Inc\MyApp.exe""/>
<CustomAction Id="QtExecDeferredExample" BinaryKey="WixCA" DllEntry="CAQuietExec"
Execute="deferred" Return="ignore" Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="QtExecDeferredExample" Before="InstallFinalize"/>
</InstallExecuteSequence>
但是,尽管 MyApp.exe 启动,但在 MyApp.exe 退出之前,安装不会终止。显然我希望应用程序启动并且安装程序终止它自己。
我无法修改 CustomAction 以在安装完成后运行..
<Custom Action="QtExecDeferredExample" After="InstallFinalize"/>
由于以下原因:
ICE77: QtExecDeferredExample is a in-script custom action.
It must be sequenced in between the InstallInitialize action and the InstallFinalize action in the InstallExecuteSequence table
任何想法表示赞赏。
更新:BrianJ 的回答让我找到了答案。正如@escist 所询问的,我的CA 的相关部分如下:
<!-- CA To set the property of the process to start-->
<CustomAction
Id ="SetProcessToStart"
BinaryKey ="WiXCustomActions"
DllEntry ="GetProcessToStart"
Execute ="immediate" />
<!-- CA to start the process-->
<CustomAction
Id ="StartApp"
Directory ="APPLICATIONROOTDIRECTORY"
ExeCommand ="[PROCESSTOSTART]"
Execute ="deferred"
Return ="asyncNoWait"/>
</Fragment>
</Wix>
和其他地方(我的许多应用程序可能已经启动了这个过程,所以它的路径存储在注册表中)..
<Property Id="PROCESSTOSTART">[Not Set]</Property>
<InstallExecuteSequence>
<!-- Use our Custom Action to set the PROCESSTOSTART property-->
<!-- Custom Action to get the value from registry of the App that started the bootstrapper-->
<Custom Action="SetProcessToStart" Before="LaunchConditions">NOT Installed</Custom>
<!-- NOT installed ensures that the CA does not get fired on an uninstall -->
<Custom Action="StartApp" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>