How to implement WiX installer upgrade?

后端 未结 12 1294
礼貌的吻别
礼貌的吻别 2020-11-22 07:05

At work we use WiX for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machi

相关标签:
12条回答
  • 2020-11-22 07:35

    Below worked for me.

    <Product Id="*" Name="XXXInstaller" Language="1033" Version="1.0.0.0" 
        Manufacturer="XXXX" UpgradeCode="YOUR_GUID_HERE">
    <Package InstallerVersion="xxx" Compressed="yes"/>
    <Upgrade Id="YOUR_GUID_HERE">
        <UpgradeVersion Property="REMOVINGTHEOLDVERSION" Minimum="1.0.0.0" 
            RemoveFeatures="ALL" />
    </Upgrade>
    <InstallExecuteSequence>
        <RemoveExistingProducts After="InstallInitialize" />
    </InstallExecuteSequence>
    

    Please make sure that the UpgradeCode in Product is matching to Id in Upgrade.

    0 讨论(0)
  • 2020-11-22 07:38

    One important thing I missed from the tutorials for a while (stolen from http://www.tramontana.co.hu/wix/lesson4.php) which resulted in the "Another version of this product is already installed" errors:

    *Small updates mean small changes to one or a few files where the change doesn't warrant changing the product version (major.minor.build). You don't have to change the Product GUID, either. Note that you always have to change the Package GUID when you create a new .msi file that is different from the previous ones in any respect. The Installer keeps track of your installed programs and finds them when the user wants to change or remove the installation using these GUIDs. Using the same GUID for different packages will confuse the Installer.

    Minor upgrades denote changes where the product version will already change. Modify the Version attribute of the Product tag. The product will remain the same, so you don't need to change the Product GUID but, of course, get a new Package GUID.

    Major upgrades denote significant changes like going from one full version to another. Change everything: Version attribute, Product and Package GUIDs.

    0 讨论(0)
  • 2020-11-22 07:41

    I used this site to help me understand the basics about WiX Upgrade:

    http://wix.tramontana.co.hu/tutorial/upgrades-and-modularization

    Afterwards I created a sample Installer, (installed a test file), then created the Upgrade installer (installed 2 sample test files). This will give you a basic understanding of how the mechanism works.

    And as Mike said in the book from Apress, "The Definitive Guide to Windows Installer", it will help you out to understand, but it is not written using WiX.

    Another site that was pretty helpful was this one:

    http://www.wixwiki.com/index.php?title=Main_Page

    0 讨论(0)
  • 2020-11-22 07:43

    I read the WiX documentation, downloaded examples, but I still had plenty of problems with upgrades. Minor upgrades don't execute uninstall of the previous products despite of possibility to specify those uninstall. I spent more that a day for investigations and found that WiX 3.5 intoduced a new tag for upgrades. Here is the usage:

    <MajorUpgrade Schedule="afterInstallInitialize"
            DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." 
            AllowDowngrades="no" />
    

    But the main reason of problems was that documentation says to use the "REINSTALL=ALL REINSTALLMODE=vomus" parameters for minor and small upgrades, but it doesn't say that those parameters are FORBIDDEN for major upgrades - they simply stop working. So you shouldn't use them with major upgrades.

    0 讨论(0)
  • 2020-11-22 07:45

    The following is the sort of syntax I use for major upgrades:

    <Product Id="*" UpgradeCode="PUT-GUID-HERE" Version="$(var.ProductVersion)">
     <Upgrade Id="PUT-GUID-HERE">
        <UpgradeVersion OnlyDetect="yes" Minimum="$(var.ProductVersion)" Property="NEWERVERSIONDETECTED" IncludeMinimum="no" />
        <UpgradeVersion OnlyDetect="no" Maximum="$(var.ProductVersion)" Property="OLDERVERSIONBEINGUPGRADED" IncludeMaximum="no" />
    </Upgrade>
    
    <InstallExecuteSequence>
        <RemoveExistingProducts After="InstallInitialize" />
    </InstallExecuteSequence>
    

    As @Brian Gillespie noted there are other places to schedule the RemoveExistingProducts depending on desired optimizations. Note the PUT-GUID-HERE must be identical.

    0 讨论(0)
  • 2020-11-22 07:48

    I'm using the latest version of WiX (3.0) and couldn't get the above working. But this did work:

    <Product Id="*" UpgradeCode="PUT-GUID-HERE" ... >
    
    <Upgrade Id="PUT-GUID-HERE">
      <UpgradeVersion OnlyDetect="no" Property="PREVIOUSFOUND"
         Minimum="1.0.0.0"  IncludeMinimum="yes"
         Maximum="99.0.0.0" IncludeMaximum="no" />
    </Upgrade>
    

    Note that PUT-GUID-HERE should be the same as the GUID that you have defined in the UpgradeCode property of the Product.

    0 讨论(0)
提交回复
热议问题