[wix-users] Feature to restart computer immediately after installing msu package is needed.

Phill Hogland phill.hogland at rimage.com
Thu Dec 1 07:23:51 PST 2016


Taking a reboot in the middle of the chain is supported using the WixStdBA, although I have not used that feature.  For my custom BA I studied the WixStdBA code to implement a similar concept.  It is a little complex to explain which I have detailed previously in these archives, and even with these comments you should study the wix source for the WiXStdBA.


The basic steps are:

In 'Startup' handler set properties in your model (for MVVM) to clear the your AfterForcedRestartPackage string property, and then test the Command.Resume object for Resume.Reboot to determine if you are resuming from a mid-chain reboot.  (if so save the name of the last package installed from WixBundleForcedRestartPackage.)


In 'PlanPackageBegin' when AfterForcedRestartPackage is specified, skip over packages in the chain until after that package is found, by returning e.State = RequestState.None.


In 'ExecutePackageComplete' decide if the package needs an immediate reboot and save that decision in your model.  If this decision is driven by the results of a CA then look at using the global atom WcaDeferredActionRequiresReboot to allow the CA to signal that it needs the reboot.  Study the wix source code for info on this functionality.


In 'ApplyComplete' process the above request to reboot, considering flags that you also tested to determine if a user allows a reboot and whether you should prompt a user or not, and if you want to take the reboot immediately then return  e.Result = Result.Restart;.


In 'Shutdown' handler if your model indicates that you should reboot (based on the logic in ApplyComplete) then return e.Result = result.Restart;.


And if you set your bundle's return code then return a result code when you call Engine.Quit(yourResultCode);


I'm sure I left out some details but you can figure it out by looking at the wix source code.

________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Sergey YUKHNO <Sergey.Yukhno at visutechsystem.by>
Sent: Thursday, December 1, 2016 8:37:47 AM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Feature to restart computer immediately after installing msu package is needed.

Hi.
Feature to restart computer immediately after installing msu package is
needed.
For example If install MSSQL Express 2008 after package KB3033929 on
windows 7, MSSQL installs partly and return error. It can be ExitCode
like in ExePackage or just option "reboot immediately if reboot
required" for msu package.
--
Best regards,
*Sergey Yukhno*
*Visutech System Ltd.*
*tel.:* +375 17 211 02 84
*fax:* +375 17 210 42 48
38 Nemiga St., Minsk, 220004
Republic of Belarus
*www.visutechsystem.by*


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list