简体   繁体   English

WiX Bundle升级:在删除旧版本之前安装新版本的MSI

[英]WiX Bundle upgrade: a new version of MSI is installed before the old version is removed

I have a WiX bundle that installs an MSI and also checks if .NET is installed. 我有一个安装MSIWiX软件包 ,还检查是否安装了.NET。 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. 在升级中,捆绑包首先安装MSI的v_Next,然后取消安装v_revious的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. 我希望在升级中,在安装v_Next之前卸载MS_的v_Previous。

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. 谢谢Rob的回答。 I'm trying to do that, but it's not working (I'm surelly missing something)... This is what I have in the MSI: 我试图这样做,但它不起作用(我肯定遗漏了一些东西)......这就是我在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. 如果我运行v_previous MSI然后运行v_Next MSI(单独,不在捆绑包中),我将同时安装,因此不会执行升级。 What Am I doing wrong? 我究竟做错了什么?


Nevermind, MajorUpgrade is working. 没关系,MajorUpgrade正在运作。 My version numbering was wrong in the vNext MSI. 我的版本编号在vNext MSI中是错误的。 I need now to also add minor upgrade support. 我现在还需要添加次要的升级支持。

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 . 要在v_Previous.msi之前删除v_Previous.msiv_Next.msi v_Next.msi主要升级(请参阅MajorUpgrade元素v_Previous.msi

** I think there is a feature request to allow other placements but no one has implemented that yet. **我认为有一个功能请求允许其他展示位置,但还没有人实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM