views:

44

answers:

1

I am creating an upgradable installer using WiX that needs to remove the existing program entirely before installing the new version. I have the files upgrading and adding that the newer version should be but I'm left with 2 instances of the Program in the Add/Remove program screen. Below is an example of how I am trying to remove everything.

<Product Id="064e9bca-dcf5-412d-9a8f-dafec3bd3406" Name="testInstall" Language="1033" Version="1.0.14" Manufacturer="testInstall" UpgradeCode="5dd5747f-c598-4133-8c7d-252ae3dee8a5">

<Package InstallerVersion="301" InstallPrivileges="elevated" InstallScope="perMachine" Compressed="yes" />

<Upgrade Id="5dd5747f-c598-4133-8c7d-252ae3dee8a5">
  <UpgradeVersion Minimum="1.0.0"
                  IncludeMinimum="yes"
                  Maximum="1.0.13"
                  OnlyDetect="no"
                  Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallInitialize"/>
</InstallExecuteSequence>

Any help that can be provided would be appreciated.

+3  A: 

Everytime you want to create a new updated package, change both ProductVersion and ProductGUI:

<?define ProductVersion="1.0.76"?>
<?define ProductGUI="945C22A0-BB37-4F7D-9B28-2F02491A0698"?>

<Upgrade Id="b14563a6-db4f-451c-8b9d-03e480687290">
    <UpgradeVersion OnlyDetect='yes' Property='NEWERVERSIONDETECTED' Minimum='$(var.ProductVersion)' IncludeMinimum='no' />
    <UpgradeVersion Minimum="1.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>

...

<InstallExecuteSequence>
   <RemoveExistingProducts After="InstallValidate" />
   ...
</InstallExecuteSequence>

NOTE: Use your own GUID for Upgrade/Id, of course.

Nestor
Thank you very much you confirmed a theory of mine. One thing I did find though was that one of the files was not being removed from the old version when it was supposed to. Do you know of any reason why a file would hang around when all the others were deleted? I found this to be the reason as it was still attached to the old version so that version was still technically installed.
Scott Boettger
Windows Installer keeps a counter for each file that is installed by more than one MSI. That file will only be removed when the count goes back to 0, that is, when both MSI's are uninstalled.
Nestor