[wix-users] Burn with mba, force reboot in middle of chain and handle restart.

Jeremy Drake jeremydrake+wix at eacceleration.com
Fri Sep 11 09:27:12 PDT 2015


> What I am missing is what should I do in the mba to detect 
> that the CA indicated that a reboot is necessary and force the reboot. 
> (Unfortunately I have a later third-party package for which the setup 
> will error out if the error in the above CA is allowed to continue 
> without doing the reboot immediately.)

on ExecutePackageComplete, e.Restart is ApplyRestart.RestartRequired.  If 
the package in question (e.PackageId) is the package that you need to do 
this for, and e.Restart is ApplyRestart.RestartRequired, set e.Result = 
Result.Restart.  Then, on ApplyComplete, use e.Restart, 
BootstrapperApplication.Command.Restart, and 
BootstrapperApplication.Command.Display to decide to prompt for reboot, 
automatically reboot, or not reboot.  Reboot by setting e.Result to 
Result.Reboot.


On Fri, 11 Sep 2015, Phill Hogland wrote:

> My mba driven package chain has a package which includes a CA in which I call a system tool to do CBS servicing.  That tool may return 0x80070bc2
>
> if (0x80070BC2 == hr) {  //success, reboot is needed, so changes may not be effective until after the reboot
> WcaLog(LOGMSG_STANDARD, "Return code, %d, indicates a reboot is needed.  The installed features may not be available until after the next reboot, but this setup will proceed.\n", hr);
>       WcaDeferredActionRequiresReboot();
>       hr = S_OK;
> }
>
> I then found Sean's helpful advice on implementing the mba code to 
> handle the restart and I implemented the Startup and PlanPackageBegin 
> changes. What I am missing is what should I do in the mba to detect 
> that the CA indicated that a reboot is necessary and force the reboot. 
> (Unfortunately I have a later third-party package for which the setup 
> will error out if the error in the above CA is allowed to continue 
> without doing the reboot immediately.)
>
> I saw the source for WIXAPI WcaDidDeferredActionRequireReboot() but am not sure where I would call this (or equivalent) from my C# mba.
>
> And then I also need to handle the situation where a reboot is not allowed as this bundle might be part of a silent script, but that is a separate issue.
>
>
> Thanks for any advice.
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
>


More information about the wix-users mailing list