tags:

views:

17

answers:

1

I am trying to get the following to work:

On the first installation of a program, it modifies the environment variables of the system, and therefore you must restart in order for the program to fully work. Doing this in WiX is fairly straight forward, you just schedule a reboot:

<InstallExecuteSequence>
    <ScheduleReboot After="InstallFinalize" />
</InstallExecuteSequence>

The problem I am having is I want to be able to do minor upgrades to this program (ones where the version number changes but the Product GUID does not) and this does not require a reboot.

In my attempts to get conditional rebooting working, I have tried to do is this:

<Product 
    ... 
    Version="1.0.1" 
    UpgradeCode="MYUPDATEGUID-C39B-4DDE-BA5B-6113463F60C2" 
    ...
    >

<Upgrade Id="MYUPDATEGUID-C39B-4DDE-BA5B-6113463F60C2">
    <UpgradeVersion OnlyDetect="yes" Property="UPGRADING"
                    Maximum="1.0.1" IncludeMaximum="yes" />
</Upgrade>

...

<InstallExecuteSequence>
    <ScheduleReboot After="InstallFinalize">NOT UPGRADING</ScheduleReboot>
</InstallExecuteSequence>

This is great, except it doesn't work. No matter what I do, it always tries to schedule a reboot.

It seems like the problem is the property UPGRADING--if I replace NOT UPGRADING with UPGRADING, it never requests a reboot.

Any insight from anyone more experienced than I am would be awesome.

+1  A: 

I'm wondering more about your initial assumption that you need to reboot. WriteEnvironmentStrings will broadcast a WM_SETTINGSCHANGE and properly written applications should respect it. Short of edge cases like Win 95 / 98 and the fact that the Service Control Manager is poorly designed and ignores these messages, I would think generally you shouldn't need the reboot in the first place.

Otherwise, if you are doing minor upgrades, consider using the property Not Installed. This will keep it from running during subsequent repairs, maintenance, removal, minor upgrades and patches.

WriteEnvironmentStrings Action

Christopher Painter