How to implement WiX installer upgrade


At work we use WiX for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine.

I've read on several places on the Internet about a major upgrade but couldn't get it to work.
Can anyone please specify the exact steps that I need to take to add uninstall previous version feature to WiX?

Best Solution

Finally I found a solution - I'm posting it here for other people who might have the same problem (all 5 of you):

  • Change the product ID to *
  • Under product add The following:

    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
    <Upgrade Id="YOUR_GUID">  
          Minimum="" Maximum=""
          IncludeMinimum="yes" IncludeMaximum="no" />
  • Under InstallExecuteSequence add:

    <RemoveExistingProducts Before="InstallInitialize" /> 

From now on whenever I install the product it removed previous installed versions.

Note: replace upgrade Id with your own GUID

Related Question