WiX Bundle upgrade: a new version of MSI is installed before the old version is removed
Asked Answered
S

1

7

I have a WiX bundle that installs an MSI and also checks if .NET is installed. Everything works as expected when installing the bundle (and the installer).

My problem is when the bundle is upgraded. In an upgrade, the bundle first installs v_Next of the MSI and when then unininstalls v_Previous of the MSI.

How can I change this order? I want that in an upgrade the v_Previous of the MSI is uninstalled before the v_Next is installed.

Below is my bundle:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
    xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">

    <Bundle Name="MyProductName"
            Version="1.0.0.0"
            Manufacturer="MyCompanyName"
            UpgradeCode="4abf3f67-1234-35b1-b2c1-dd7649b60e1d">

        <BootstrapperApplicationRef
            Id="WixStandardBootstrapperApplication.RtfLicense">

            <bal:WixStandardBootstrapperApplication
                SuppressOptionsUI="yes"
                LicenseFile="License.rtf"
                ThemeFile="Theme.xml"
                LogoFile="MyProductName.png"
            />
            <Payload
                Name="BootstrapperCore.config"
                SourceFile="BootstrapperCore.config"/>
            <Payload
                SourceFile="NetfxLicense.rtf"/>
        </BootstrapperApplicationRef>
        <Chain>
            <PackageGroupRef
                Id="Netfx4Full"/>
            <MsiPackage
                Compressed="yes"
                SourceFile="$(var.SolutionDir)\Setup\MyProductName.msi"
                Vital="yes">
            </MsiPackage>
        </Chain>
    </Bundle>
    <Fragment>
        <WixVariable
            Id="WixMbaPrereqPackageId"
            Value="Netfx4Full" />
        <WixVariable
            Id="WixMbaPrereqLicenseUrl"
            Value="NetfxLicense.rtf" />

        <util:RegistrySearch
            Root="HKLM"
            Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
            Value="Version"
            Variable="Netfx4FullVersion" />
        <util:RegistrySearch
            Root="HKLM"
            Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
            Value="Version"
            Variable="Netfx4x64FullVersion"
            Win64="yes" />

        <PackageGroup
            Id="Netfx4Full">

            <ExePackage
                Id="Netfx4Full"
                Cache="no"
                Compressed="no"
                PerMachine="yes"
                Permanent="yes"
                Vital="yes"
                SourceFile="$(var.SolutionDir)\packages\dotNetFx40_Full_x86_x64.exe"
                DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
                DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)"/>
        </PackageGroup>
    </Fragment>
</Wix>

Thank you Rob for the answer. I'm trying to do that, but it's not working (I'm surelly missing something)... This is what I have in the MSI:

<Product Id="*"
         Name="MyProductName"
         Language="1033"
         Version="1.0.0.0"
         Manufacturer="MyCompanyName"
         UpgradeCode="aa027fd0-5111-1236-9af6-55581a588123">
    <Package InstallerVersion="200"
             Compressed="yes"
             InstallScope="perMachine" />
    <MajorUpgrade DowngradeErrorMessage="A newer version of MyProductName is already installed."
                  AllowDowngrades="no"/>
    <MediaTemplate />

    <Feature Id="ProductFeature"
             Title="MyProductName"
             Level="1">
        <ComponentRef Id="ApplicationShortcut" />
        <ComponentGroupRef Id="AllFiles" />
    </Feature>
</Product>

If I run the v_previous MSI and then v_Next MSI (separatelly, not within the bundle) I get both installed, so no upgrade is being performed. What Am I doing wrong?


Nevermind, MajorUpgrade is working. My version numbering was wrong in the vNext MSI. I need now to also add minor upgrade support.

Salleysalli answered 1/3, 2013 at 10:57 Comment(0)
M
3

Upgraded bundles are always uninstalled last today**. To remove v_Previous.msi before v_Next.msi, have the v_Next.msi major upgrade (see the MajorUpgrade element) the v_Previous.msi.

** I think there is a feature request to allow other placements but no one has implemented that yet.

Mammal answered 1/3, 2013 at 14:26 Comment(1)
Thank you Rob, please check my comment below.Salleysalli

© 2022 - 2024 — McMap. All rights reserved.