WiX Burn after restart/force reboot continuing installation

戏子无情 提交于 2019-11-30 17:08:25

问题


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"/>

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?


回答1:


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.

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.
 }


来源:https://stackoverflow.com/questions/16166186/wix-burn-after-restart-force-reboot-continuing-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!