简体   繁体   中英

With Wix Toolset is there a way with MajorUpgrade to set a minimum version

We have been using the MajorUpgrade element in wix 3.11.1.2318, and our installer is not upgrading properly. It is not removing files and is leaving an extra entry in add/remove programs. During our build we switch Version="0.0.0.0" with the current version.

Below is a reduced sample to show our usage:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" >


  <Product Id="*" Name="My Product" Language="1033" Version="0.0.0.0" Manufacturer="MyCompany"
         UpgradeCode="{B55B9CB0-BA28-4BB3-834B-6075AD5D45E4}">

    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    <UIRef Id="WixUI_ErrorProgressText" />


    <!-- Specify UI -->
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALL_FOLDER" />
    <Property Id="RestoreFiles" Value="INSTALL_FOLDER" />


    <MajorUpgrade  AllowDowngrades="no" AllowSameVersionUpgrades="yes" DowngradeErrorMessage="!(loc.NewerVersionInstalled)" />

</Wix>

I looked at the Upgrade table in our msi, one entry had the MinVersion set to the version we had built and with no max version. Another entry had the MaxVersion set to the version we had just built, and with no min version.

I thought that with the MinVersion set to our current version we would not be able to remove the files, so I looked at the Upgrade element and replaced the MajorUpgrade element.

<!--
<MajorUpgrade  AllowDowngrades="no" AllowSameVersionUpgrades="yes" DowngradeErrorMessage="!(loc.NewerVersionInstalled)" />
-->

<Upgrade Id="{B55B9CB0-BA28-4BB3-834B-6075AD5D45E4}">
  <UpgradeVersion Minimum="1.0.0"
                  IncludeMinimum="yes"
                  OnlyDetect="no"
                  Maximum="0.0.0.0"
                  IncludeMaximum="no"
                  Property="OLDVERSIONFOUND" />
</Upgrade>    

<InstallExecuteSequence>

  <RemoveExistingProducts After="InstallInitialize" />    

</InstallExecuteSequence>

This did remove the older files, but left the second add/remove programs entry.

Is there a way with MajorUpgrade to set a minimum version? Should I stay with Upgrade if there is no method to set minimum version? What might be causing the second entry?

Logging : Please make sure to create a proper verbose log file for better clues to what is going on.


Major Upgrades : Some previous answers:

The upgrade settings you describe sound normal for WiX. I assume your build process successfully replaces the placeholder 0.0.0.0 (you search for that and replace it I presume). You could also use WiX variables and pass the value in, but that is another story.


Dangling Version? : Are you sure you don't have a dangling version in Add / Remove that isn't removed because it was a test version or something like that? Try generating a list of installed packages . Previous link is for a script which creates a small HTML report, you can try this simpler script to create output in *.csv format (which you can import to Excel and sort by name column to find duplicates easily). Try to install on a clean virtual to make sure. Just need to verify that this is not the case - one of those things that can be left unverified and be the cause.


Upgrade Table : Below is a sample upgrade table. Notice that the first entry is for the real major upgrade. It will detect all lower versions than the max version specified. You don't need to upgrade if your version is already installed. Hence we don't need max to be higher than the current version we install. In fact if the version you try to install you are supposed to go into "maintenance mode" - which shows a list of features you have installed and whatever features you have not installed.

The second row is to prevent overwriting a higher, existing installed version with a lower version than the setup you are running.

升级表

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