简体   繁体   English

更改UpgradeCode GUID和版本后,Wix MajorUpgrade无法正常工作

[英]Wix MajorUpgrade not working, after changing UpgradeCode GUID & Version

We are using the following code in our Wix Packages.wxs file, as per the documentation we are changing the UpgradeCode GUID & Version number from. 根据文档,我们在Wix Packages.wxs文件中使用以下代码,从中更改了UpgradeCode GUID和版本号。 1.0.1.0 to 1.0.2.0 but when we build and try to install the msi package it says older version is still installed and we need to uninstall it to continue. 从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 安装程序错误

For major upgrades, you change the Product element's Id attribute not the UpgradeCode attribute. 对于重大升级,您可以更改Product元素的Id属性,而不更改UpgradeCode属性。 In fact, UpgradeCode attribute must remain constant across versions to use the MajorUpgrade element. 实际上,要使用MajorUpgrade元素, UpgradeCode属性必须在各个版本中保持不变。 MSDN has all the details . MSDN包含所有详细信息

I maintain an open source project called IsWiX that provides templates and designers to accelerate the WiX / MSI learning and development process. 我维护着一个名为IsWiX的开源项目,该项目提供了模板和设计器以加速WiX / MSI的学习和开发过程。 One of the many things these templates do out of the box is provide proper Major Upgrade support. 这些模板提供的许多现成功能之一就是提供适当的重大升级支持。 Consider this code generated by the template: 考虑以下由模板生成的代码:

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>

In addition to be documented in the comments, it's also discussed in the tutorials . 除了在注释中进行记录外,还将在教程中进行讨论。

In a nutshell, you need to keep UpgradeCode the same and randomize ProductCode. 简而言之,您需要保持UpgradeCode不变,并随机分配ProductCode。

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

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