【发布时间】:2011-06-08 11:48:00
【问题描述】:
我需要在安装过程中重新启动 Windows Explorer 进程。目前我们强制用户重新启动以确保资源管理器进程真正重新启动,但我想更灵活一点。
我有一个可以在安装过程中调用的 restartexplorer 可执行文件。我想做的是调用restartexplorer 可执行文件并仅在restart explorer 自定义操作返回错误代码时使用ScheduleReboot。
我可能会这样定义:
<CustomAction Id='RestartProperty' Property='QtExecCmdLine'
Value='"[INSTALLDIR]RestartExplorer.exe"' />
<CustomAction Id='Restart' BinaryKey='WixCA' DllEntry='CAQuietExec' Execute="immediate" Return="check" />
那么 InstallExecuteSequence 会是这样的:
<InstallExecuteSequence>
...
<Custom Action="RestartProperty" Before="Restart">PREVIOUSVERSIONSINSTALLED</Custom>
<Custom Action="Restart" After="SomeAction">PREVIOUSVERSIONSINSTALLED</Custom>
<ScheduleReboot After="Restart"><![CDATA[(NOT Installed) AND (SomeErrorValue > 0)]]></ScheduleReboot>
</InstallExecuteSequence>
问题是如何从之前的自定义操作中获取错误代码?我可以使用 QtExecCmdLine 并且仍然能够检查错误代码,还是我必须直接从自定义操作标签访问可执行文件?这必须在 Windows XP SP3 和更新版本上工作,我更喜欢一个不需要在操作系统版本之间有所不同的解决方案。
【问题讨论】:
标签: installation wix conditional wix3 custom-action