简体   繁体   中英

WIX installer Can't upgrade from previously installed Windows installer SW

I am creating a WIX installer for our software and now I have some issue when upgrading from previous Windows Installer packaged SW.

One thing before the problem, the upgrade from one WIX packaged SW to another WIX packaged SW is actually working fine, I am able to uninstall the older version and install the newer version. The real problem happens when the older version is Windows Installer packaged (which is our current solution) and the newer version is WIX packaged. Basically my WIX installer is unable to find out that a older version is already installed, so the newer version will be installed without uninstalling the old version.

How I make the connection between WIX installer and Windows installer: I set the UpgradeCode of WIX as the same as Windows installer one. I also check some examples online, and they suggest my current solution should work. Here is part of my .wxs file of the upgrade part:

<Upgrade Id="$(var.UpgradeCode)">

  <UpgradeVersion OnlyDetect="yes" Minimum="$(var.VersionNumber)" Property="NEWPRODUCTFOUND" IncludeMinimum="no" />
  <UpgradeVersion OnlyDetect="no" Maximum="$(var.VersionNumber)" Property="UPGRADEFOUND" IncludeMaximum="no" />           
</Upgrade>

<CustomAction Id="PreventDowngrading" Error="A software with newer version number is found on this machine" />        

<InstallUISequence>
  <Custom Action="PreventDowngrading"
          After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>    

<InstallExecuteSequence>
  <Custom Action="PreventDowngrading"
      After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <RemoveExistingProducts After="InstallFinalize" />   
</InstallExecuteSequence>

One thing might be worth mentioning is our SW is actually a Windows Service, I am not sure whether that matters. Thanks for any help!

Having the same upgradecode is not enough. You must also check that the two packages have the same install type, ie they both get installed per-user or per-machine. If the install type is different Windows Installer will skip the removal of the old version.

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