0
votes

Im using WIX to create a MSI installer. All fine, I was able to create my own product and create everything fine.

But when I get to the point I want to create an upgrade, it's not working.

I used the following code, where $(var.ProductUpgradeCode) is define and use as upgrade-code in the product element.

        <Upgrade Id="$(var.ProductUpgradeCode)">
        <UpgradeVersion OnlyDetect="yes" Property="SELFFOUND"
            Minimum="$(var.ProductVersion)" IncludeMinimum="yes"
            Maximum="$(var.ProductVersion)" IncludeMaximum="yes" />
        <UpgradeVersion OnlyDetect="yes" Property="NEWERFOUND"
            Minimum="$(var.ProductVersion)" IncludeMinimum="no" />
    </Upgrade>


    <CustomAction Id="AlreadyUpdated" Error="[ProductName] has already been updated to [ProductVersion] or newer." />
    <CustomAction Id="NoDowngrade" Error="A later version of [ProductName] is already installed." />

    <InstallExecuteSequence>
        <Custom Action="AlreadyUpdated" After="FindRelatedProducts">SELFFOUND</Custom>
        <Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom>
        <RemoveExistingProducts After="InstallFinalize"></RemoveExistingProducts>
    </InstallExecuteSequence>

In Old MSI, Product Id="GUID1" Version="1.0.0"

In New MSI, Product Id="GUID2" Version="1.0.1"

When Old is installed and I try to install the new. The Old MSI is launch and ask the Change/Repair/Remove Dialog. But I would like to proceed to installation and when pressing "Install" (before progressDlg), I would like to uninstall the old version.

Only a single file change between 1.0.0 and 1.0.1. All my file have their own component with their own GUID set (not auto).

What is wrong ? Is it something with new WIX version ? I downloaded the latest one yesterday.

1
I do not think that your issue is in the presented code - this is because it is not relevant for the update situation you described in any way. For such minor upgrade case you need to start the installation with the correct parameters. You only need to use the Upgrade element for upgrades on earlier installations that use a different upgrade code, all others will be handled perfectly by the MajorUpgrade element.Florian Haupt

1 Answers

1
votes

Assuming everything else is correct in your new MSI, the error I see is that there is OnlyDetect=yes in your upgrade settings. As the WiX documentation says "Set to "yes" to detect products and applications but do not uninstall." So start by changing that.

Note that it's more usual to use the MajorUpgrade element, which takes care of the settings. Without a verbose log it's not obvious that everything else is correct (such as FindRelatedProducts in your MSI).