2
votes

I'm currently using wix to build a installer, here are some requirements that I've no idea how to do it.

  • (installer of the same build or new build, but the same version) user can click the installer to reinstall the software without the need to uninstall it first.

  • while installation there are some configuration in the UI process, and the result has been written to a file in the installation folder, can we load these parameters from the file while reinstalling the software?

    I've tried the

    • same product id;
    • modify the Product Version from "1.0.0" to "1.0.1"

    in the wxs, and I've added with the same upgrade code in the , added RemoveExistingProducts Before="InstallInitialize"

in Installation sequence, but I still get "wix another version of this product is already installed" Error.

Please help.

    <Product  Id='fixed-ID' 
              UpgradeCode='fixed-upgrade-ID' 
              Version='1.1.1' > 
        <Package InstallerVersion='300'/>

            <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />

            <Upgrade Id="fixed-upgrade-ID">
                <UpgradeVersion Property="PREVIOUSVERSIONSINSTALLED" 
                  Minimum="0.0.0" 
                  Maximum="1.1.1" 
                  IncludeMaximum="no" 
                  IncludeMinimum="yes"
                  OnlyDetect="no" 
                  />
            </Upgrade>

        <InstallExecuteSequence>

          <RemoveExistingProducts Before="InstallInitialize" />
       </InstallExecuteSequence>
    </Product>

1

1 Answers

3
votes

I recommend using the MajorUpgrade element that is present in the latest versions of WiX. It takes a lot of the complexity out of creating an installer that supports upgrade. You do need to make sure you change both Product-ID and Version. You'll always get an error if you don't change Product ID (unless you run the install with the REINSTALLMODE containing 'v', but that is a minor upgrade and restricts what you can do). Version must be changed to ensure you have a one way upgrade path, otherwise old installers could upgrade newer ones if they had the same version.

This how-to has a great walk-through.