views:

1889

answers:

3

I wrote an install program with wix and it worked fine to install my program. Now I need to update it, so I bumped up the version number but when I go to install the new program over the old one it complains that an older version is already installed and tells me to uninstall it fisrt. How do I get it to update or automatically uninstall it before reinstalling?

+3  A: 

This post worked for me.

Juanma
This works, but I got burned a little because our build auto-increments the 4th number in the build, which does not count as a new version to WiX. So, 1.0.0.338 will not un-install 1.0.0.337.
Randy Eppinger
+2  A: 

you need to use the upgrade table:

< Upgrade Id='15E2DAFB-35C5-4043-974B-0E342C25D76A'>
    < UpgradeVersion Property='OLDVERSIONFOUND' IncludeMinimum='no' Minimum='0.0.0.0' />
< /Upgrade>

you need also add a action:

 < InstallExecuteSequence>
    < LaunchConditions After='AppSearch' />
    < RemoveExistingProducts After='InstallValidate' />
 < /InstallExecuteSequence>

here is a tutorial

Bernd Ott
A: 

I checked through all the posts mentioned above and still spent ages trying to get this to work.

The hint on the official HOWTO for upgrades in Step 3 helped a lot: You need a new Product/@Id to disable the message "Another version of this product is already installed".

I used this upgrade section (child of Product):

<Upgrade Id="$(var.UpgradeCode)">
  <UpgradeVersion Minimum="1.0.0"
                  IncludeMinimum="yes"
                  OnlyDetect="no"
                  Maximum="$(var.Version)"
                  IncludeMaximum="no"
                  Property="PREVIOUSFOUND" />
</Upgrade>

Note that OnlyDetect is set to "no". This triggers the removal of the old version, if you have the following section (child of Product):

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

Also note that apparently, only the first three components of the version number are used to check for upgrades...

Daren Thomas