Building MSIs with WixSharp since years, I always followed this rule which basically says:
For each new release of your application, change the ProductCode but never change the UpgradeCode.
This always worked perfectly but recently I discovered that installing a newer release of my application does not replace the previous version but instead is getting installed in parallel.
Running this PowerShell script gives me this result on a test machine:
My question
What is the reason that a MSI file does not replace an existing one upon installation with the same UpgradeCode?
(I've also posted this as a question on the WixSharp GitHub repository)
Update/solution
I've finally managed to solve it. Basically I did the following things:
- Removed the version string from my setups name (since MSI seems to also compare then names to check whether an upgrade is possible; only the same name seems to fit)
- Changed my version number from 4 to 3 digits, as Christopher pointed out. I.e. I'm now incrementing e.g. "1.0.0" to "1.0.1" etc.
- Added this code to my WixSharp
ManagedProject
instance:InstallScope = InstallScope.perMachine, MajorUpgradeStrategy = new MajorUpgradeStrategy { UpgradeVersions = VersionRange.OlderThanThis, PreventDowngradingVersions = VersionRange.NewerThanThis, NewerProductInstalledErrorMessage = "Newer version already installed.", RemoveExistingProductAfter = Step.InstallInitialize },
After these changes, an upgrade succeeded.