【问题标题】:Wix MajorUpgrade not working, after changing UpgradeCode GUID & Version更改 UpgradeCode GUID 和版本后,Wix MajorUpgrade 不起作用
【发布时间】:2019-08-16 16:15:49
【问题描述】:

我们在我们的 Wix Packages.wxs 文件中使用以下代码,根据我们更改 UpgradeCode GUID 和版本号的文档。 1.0.1.0 到 1.0.2.0 但是当我们构建并尝试安装 msi 包时,它说旧版本仍在安装,我们需要卸载它才能继续。

<Product Id="8B3DFDFF-D894-4A31-AA92-824729385F15" Name="WixCodeBase" Language="1033" Version="1.0.2.0" Manufacturer="Company Name" UpgradeCode="C78D9362-A156-44A2-94D0-AFA19389FFE8">
 <Package Id="*" Keywords="Installer" Manufacturer="Company Name" Description="Wix Installer" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
     <MajorUpgrade Schedule ="afterInstallValidate" AllowDowngrades="no" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
            <Media Id='1' Cabinet='WixPackage.cab' EmbedCab='yes' />

Installer Error

【问题讨论】:

    标签: wix


    【解决方案1】:

    对于重大升级,您更改Product 元素的Id 属性而不是UpgradeCode 属性。事实上,UpgradeCode 属性必须跨版本保持不变才能使用MajorUpgrade 元素。 MSDN has all the details.

    【讨论】:

      【解决方案2】:

      我维护一个名为 IsWiX 的开源项目,该项目提供模板和设计器来加速 WiX / MSI 学习和开发过程。这些模板开箱即用的众多功能之一是提供适当的主要升级支持。考虑模板生成的这段代码:

      Code Source

      <?xml version="1.0" encoding="UTF-8"?>
      <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <!-- 
        MSIProductVersion is defined in DesktopApplication.wixproj as 0.0.1 for local desktop builds.  
        You should pass in the MSBuild Property 'MSIProductVersion' to override it during an automated build.
        See http://msdn.microsoft.com/en-us/library/windows/desktop/aa370859%28v=vs.85%29.aspx for information on allowable values.
      
        The Product@Id attribute (ProductCode Property) will be a random GUID for each build.  This is to support "Major Upgrades" where each install 
        is a seamless uninstall/reinstall.
        -->
        <Product Id="*" Name="DesktopApplication" Language="1033" Version="$(var.MSIProductVersion)" Manufacturer="DesktopApplication" UpgradeCode="7220a19b-ed49-4cd1-8002-6af7926441b4">
          <Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" />
          <MediaTemplate EmbedCab="yes" />
      
          <!-- Major Upgrade Rule to disallow downgrades -->
          <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
      
          <!--Common Launch Condition-->
          <!-- Examples at http://wixtoolset.org/documentation/manual/v3/customactions/wixnetfxextension.html -->
          <PropertyRef Id="NETFRAMEWORK40FULL"/>
          <Condition Message="[ProductName] requires .NET Framework 4.0.">Installed OR NETFRAMEWORK40FULL</Condition>
      
          <!-- Include User Interface Experience -->
          <Icon Id="Icon.ico" SourceFile="Resources\Icon.ico"/>
          <Property Id="ARPPRODUCTICON" Value="Icon.ico"></Property>
          <UIRef Id="UI"/>
      
          <!-- Include Features and Directories Fragment -->
          <DirectoryRef Id="INSTALLLOCATION"/>
      
        </Product>
      </Wix>
      

      除了在 cmets 中记录之外,还在 tutorials 中进行了讨论。

      简而言之,您需要保持 UpgradeCode 不变并随机化 ProductCode。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-09
        • 1970-01-01
        • 1970-01-01
        • 2017-10-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多