Reputation: 1245
I want to remove the older version and install the latest version setup. If installing the older version means, need to restrict the downgrade.
I have enabled the upgrade and removed the older version if exist using below code.
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="{Guid}">
<UpgradeVersion Minimum="1.1.0.1" Maximum="99.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<RemoveExistingProducts Before="InstallInitialize" />
But i don't know how to disable the downgrade option. I am getting solution to restrict the downgrade for 3 digit(x.x.x) version. But can get solution to restrict 4 digit(x.x.x.x) version.
Upvotes: 0
Views: 1040
Reputation: 20780
There is no support in Windows Installer (and therefore in WiX generation of MSI major upgrades) for major upgrade logic based on four fields of the ProductVersion. As the docs say:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370859(v=vs.85).aspx
"Note that Windows Installer uses only the first three fields of the product version. If you include a fourth field in your product version, the installer ignores the fourth field."
The issue is that a major upgrade requires a change in the first 3 fields, so using four fields means you can't use a major upgrade of any kind. You might be able to create a custom bootstrapper that looks at installed versions and incoming upgrade versions, and it would detect attempts to downgrade, but you'd need to uninstall that older version then install the upgrade separately, and there would be recovery, no single transaction to restore the system in case of failure somewhere. The rules say three fields are used in major upgrades.
Upvotes: 1