Jonny Piazzi
Jonny Piazzi

Reputation: 3784

Remove previous installation on WiX

I have a product distributed on a website. Every time a user downloads this file, I compile everything again with WiX. In each build, the version doesn't change, but some files do.

Question
How to force the installer to uninstall my software, no matter the version, before it begins the installation itself?

EDITED
I already tried this:

<MajorUpgrade DowngradeErrorMessage="Erro Message." />

Upvotes: 1

Views: 3637

Answers (1)

Isaiah4110
Isaiah4110

Reputation: 10080

Change the product ID to *, this will ensure that a unique GUID is generated during the MSI compilation.

Then add the following :

<Property Id="OLDVersion" Secure="yes" /> 
<Upgrade Id="YOUR_GUID">      
     <UpgradeVersion
            Minimum="1.0.0.0" Maximum="99.0.0.0"
            Property="OLDVersion"
            IncludeMinimum="yes" IncludeMaximum="no" /> 
</Upgrade>

Under InstallExecuteSequence add:

<RemoveExistingProducts Before="InstallInitialize" /> 

This should take care of uninstalling the previously installed versions.

Make sure that the Upgrade GUID which you are using is common across all the versions of your MSI.

Check this LINK

Upvotes: 3

Related Questions