1

I’m building installer for my product, using WiX Toolset 3.10.2.

Have two WIX projects in the solution, one builds MSI from compiled binaries, another builds setup.exe from the MSI using WixStandardBootstrapperApplication.

If I increase version, it works OK, offers to upgrade.

If I launch the same installer second time, it works OK, opens with “Modify setup” screen.

The problem is, after I rebuild the installer without increasing version, it fails to detect previous install, and happily installs second time (so the “uninstall” control panel has multiple identical items).

How to stop that, and only allow single installed instance of the product?

The MSI:

<?include "..\Version.wxi"?>

<Product Id="*" Name="xxx" Language="1033" Version="$(var.vvvVersion)"
        Manufacturer="yyy" UpgradeCode="0d88cab0-d278-43bb-b891-607bc01c4dec" >
    <MajorUpgrade DowngradeErrorMessage="A newer version of xxx is already installed." />

The EXE:

<?include "..\Version.wxi"?>

<Bundle Name="xxx" Manufacturer="yyy" Version="$(var.vvvVersion)"
        UpgradeCode="eac46fb0-09d1-4c29-8fc1-984dddb35e50"
        IconSourceFile="$(var.SolutionDir)applicationIcon.ico" >

1 Answer 1

2

It is the default behaviour of a bundle to leave the previous bundle behind if the version of the currently installing bundle is <= to the installed bundle's version.

There are two ways to get around this. One is relatively simple to implement and the other one requires editing the code of your bootstrapper application.

The first way to fix this, as you have noted, is have the version of your bootstrapper tied to the build number or revision number of your code so that the a portion of the version is always increasing. This way the bootstrapper always knows to remove the previously installed bundle exe. To note, the Bootstrapper Application does take into account the full 4 parts of the version unlike MSI's which discard the 4th digit. This is the solution I implement in my bootstrapper applications.

The second way to solve this issue is to override the requestedState in OnPlanRelatedBundle. (For reference https://sourceforge.net/p/wix/bugs/3065/)

Sign up to request clarification or add additional context in comments.

1 Comment

Even if he does that (for which there's currently a discussion to enable that by default), the MSI will exhibit similar problems without the version being upgraded. I actually added support years back for your MSI to pick up a file version and the bundle to pick up the product version: <Product Version="!(bind.fileVersion.*fileId*)"> <Bundle Version="$(bind.packageVersion.*productId*)"> You can also change your MSI's Upgrade table to allow same-version upgrades - necessary to test any changes in subsequent builds of the same version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.