0
votes

I want to remove/uninstall pre-installed lower version MSI before/with installation of a higher version of MSI. My product codes are always unique and upgrade codes are always the same.

(I don't want to allow downgrading installation.)

But when I install a higher product version MSI, it gets installed but the add/remove program entries for both new installed and previously installed MSIs still exist. How to overcome this issue ? Following is my code

<Product Id="*" Name="MyApp" Language="1033" Version="1.11.1111"  UpgradeCode="00000000-8030-4B76-8F3A-8B8BB1000000">
<Package InstallerVersion="200" Compressed="yes" Platform="x86" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowDowngrades="no" Schedule="afterInstallInitialize"/>

<Upgrade Id="{00000000-8030-4B76-8F3A-8B8BB1000000}">
  <UpgradeVersion OnlyDetect="no" Maximum="99.0.0.0" Property="PREVIOUSVERSIONSINSTALLED" IncludeMaximum="no"/>
  <UpgradeVersion OnlyDetect="yes" Minimum="1.0.0.0" Property="NEWERPRODUCTFOUND" IncludeMinimum="no"/>
</Upgrade>
1

1 Answers

1
votes

As you can see from this:

http://www.joyofsetup.com/2010/01/16/major-upgrades-now-easier-than-ever/

The MajorUpgrade element replaces the Upgrade elements. You've got both upgrade types specified so that may be causing some issues.

If the version has incremented in the first three fields, the UpgradeCode is the same and the ProductCode is new, then the most likely cause of a failure (and getting two entries installed) is that the prior one was perUser (or perMachine) and your upgrade is the opposite. Major upgrades must be in the same context.