views:

70

answers:

2

I only want to reboot when uninstalling. This is a fragment from my WiX file:

<InstallExecuteSequence>
  ...
  <Custom Action="CleanRegistry" Sequence="7100">REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
  <ScheduleReboot Sequence="7200">REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE</ScheduleReboot>
</InstallExecuteSequence>

Running the generated MSI produces the following log:

MSI (s) (48:7C) [10:19:29:951]: Skipping action: CleanRegistry (condition is false)
MSI (s) (48:7C) [10:19:29:951]: Doing action: ScheduleReboot

How is it possible that the same condition evaluates to False then True? Does ScheduleReboot ever ignore its condition?

Edit: I am also trying to use the condition REBOOT~="Force" to conditionally execute a command when a reboot has been requested by my customaction. This condition is never evaluating to true and my command is not being run. The property is being set by a call to MsiSetProperty from a custom action. Either this custom action is not working or I have made a mistake in my condition! Any suggestions?

+1  A: 

Some action might be setting the REBOOT property. You should be able to see that in the log. The most common reason is probably files in use.

On Freund
I have a custom action which I am expecting to set REBOOT=FORCE. Will this cause ScheduleReboot to ignore its condition?
mchr
I don't the know the exact implementation details, but my guess is that all ScheduleReboot does is to set REBOOT=FORCE. You've essentially done the same without it.
On Freund
That sounds as expected but still begs the question why the log shows that the ScheduleReboot action is executed.
mchr
Is it possible that a previous action changes the value of REMOVE?
On Freund
The WiX fragment I posted does not hide any intermediate actions. CleanRegistry is skipped and then ScheduleReboot is called and the condition evaluates to true!
mchr
A: 

I don't know why the original code was failing but I have ended up settling on the following which only does a reboot on upgrade or uninstall.

<ScheduleReboot Sequence="7200">REMOVE~="ALL"</ScheduleReboot>
mchr