问题
I've got a WiX deferred custom action that conditionally modifies some registry keys. For the changes to take effect, a reboot is required. I'd like the user to get the standard dialog box that prompts them to reboot after the installation completes.
How can I schedule a reboot from a deferred custom action?
回答1:
Why do you have a custom action doing something that MSI/WiX knows how to do natively?
A cleaner approach would be to have registry values associated with a component that has the needed condition. Then you can have a simple custom action trigged by that same condition call MsiSetMode with the MSIRUNMODE_REBOOTATEND argument. If you are using C#/DTF that's session.SetMode(InstallRunMode.RebootAtEnd).
This way if the install is aborted, canceled, failed it can roll back the registry changes.
来源:https://stackoverflow.com/questions/27398174/schedule-reboot-from-wix-deferred-custom-action