问题描述
我有一个使用 ManagedBootstrapperApplicationHost 的 WiX Burn 自定义安装程序.在安装 Microsoft Windows Installer 4.5 的先决条件之一后,我使用强制重启 PC (Windows XP):
I have a WiX Burn custom installer using ManagedBootstrapperApplicationHost. After installing one of the prerequisite Microsoft Windows Installer 4.5 I forcefully reboot the PC (Windows XP) using:
<ExitCode Behavior="forceReboot"/>
Bundle 链如下所示:
The Bundle chain looks like this:
<Chain>
<PackageGroupRef Id="WindowsInstaller45"/>
<PackageGroupRef Id="Netfx2Full"/>
<PackageGroupRef Id="Netfx4Full"/>
<PackageGroupRef Id="CustomPkg"/>
<PackageGroupRef Id="SQLExpress"/>
</Chain>
重启后,我希望我的安装在此之后继续,但它实际上会检测到安装并显示卸载选项.
After it reboots, I want my installation to continue after that, but it actually detects the installation and shows Uninstall option.
在安装过程中重新启动时如何检测未完成的安装?
How can I detect an unfinished installation when reboot happens during installation?
推荐答案
当 Bundle 在重启后再次启动时,传递给 BootstrapperApplicationCreate
函数的 BOOTSTRAPPER_COMMAND
结构包含一个resumeType
字段将设置为 BOOTSTRAPPER_RESUME_TYPE_REBOOT
.在托管代码中,BootstrapperApplication
类包含一个 Command
属性,该属性包含 resume
字段.
When the Bundle is started again after a restart the BOOTSTRAPPER_COMMAND
struct passed to your BootstrapperApplicationCreate
function contains a resumeType
field that will be set to BOOTSTRAPPER_RESUME_TYPE_REBOOT
. In managed code, the BootstrapperApplication
class contains a Command
property that contains the resume
field.
例如在托管代码中,要告诉您的 BootstrapperApplication
在重新启动后启动,您可以检查:
For example in managed code, to tell that your BootstrapperApplication
started after a restart, you can check:
if (BootstrapperApplication.Command.resume == ResumeType.Reboot)
{
// started after restart, go straight to Detect->Plan->Apply to finish the
// previous operation. BootstrapperApplication.Command.action will tell us
// the action to complete.
}
else
{
// started normally, show typical UI scenarios.
}
这篇关于WiX Burn 重启后/强制重启继续安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!