I've just updated our wix install scripts as per this previous question/answer How to implement WiX installer upgrade?. The idea was to prevent an older version 'downgrading' a newer version. So I have parts of the wix file that look like:
<Product Id="A_GUID"
<Upgrade Id="18626be5-521c-4b58-ab8a-54baddf66679">
<UpgradeVersion
Property="NEWERVERSIONDETECTED"
Minimum="$(var.Version)"
IncludeMinimum="no"
OnlyDetect="yes"
ExcludeLanguages="yes"
/>
</Upgrade>
<CustomAction Id="NewerVersionFound" Error="Can't downgrade." />
<InstallExecuteSequence>
<Custom Action="NewerVersionFound"
After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
<RemoveExistingProducts After="InstallInitialize" />
</InstallExecuteSequence>
I have two versions of this, say 2.1 and 2.2. The current practice is to keep the Product Id Guid (shown as 'A_GUID' above) the same for minor versions (like 2.x) and only to change for major - so moving from 1.x to 2.x we change the Guid.
But, the above doesn't work if the Product Guid is kept the same for 2.1 and 2.2, despite the '$(var.Version)' changing. If I change the Guid, it does work (and prevents the downgrade 2.2 -> 2.1).
I was wondering why this is the case (assuming I'm doing it correctly) - why do we need two bits of information (guid and version) for this to work?
Edit1a: There is an UpgradeCode Guid in the wix, which stays the same for each version. Edit1b: If it's relevant, this is done with an old version of wix (2.x).