简体   繁体   中英

I have installed major upgrade successfully but it also allowing another previous version install in wix

I have installed major upgrade (say #206) successfully and included code as in (#206):

<Upgrade Id="$(var.ProductUpgradeCode)">
  <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWPRODUCTFOUND" />
  <UpgradeVersion Minimum="1.0.0.178" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Language="1033" Property="UPGRADEFOUND" />
</Upgrade>

Scenario is: I have installed build #177 then upgraded to build #206. It is still allowed to install #177 which I want to prevent this downgrade.

From build #178 onward I have changed product GUID for major upgrade and which is working fine. Please suggest how to prevent this. I don't want to downgrade build below 177. If I have done major upgrade on build no <= 177 .

Your problem is the how the comparison of versions is done in MSI by default - 1.0.0.123 is treated the same as eg 1.0.0.33. You either have to increase your revision version to make the installer detect this as an older version or use a workaround.

You might for instance create a custom action to check against this very Revision version and place it eg before InstallValidate:

<CustomAction Id='MyVersionCheck' Return='check' (...) />

<InstallExecuteSequence>
    <Custom Action='MyVersionCheck' Before='InstallValidate' />
</InstallExecuteSequence>

Some more information can be found in this article , for informations about how to create custom actions i'd recommend this blog entry as a starting point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM