簡體   English   中英

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

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

根據文檔,我們在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' />

安裝程序錯誤

對於重大升級,您可以更改Product元素的Id屬性,而不更改UpgradeCode屬性。 實際上,要使用MajorUpgrade元素, UpgradeCode屬性必須在各個版本中保持不變。 MSDN包含所有詳細信息

我維護着一個名為IsWiX的開源項目,該項目提供了模板和設計器以加速WiX / MSI的學習和開發過程。 這些模板提供的許多現成功能之一就是提供適當的重大升級支持。 考慮以下由模板生成的代碼:

代碼源

<?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>

除了在注釋中進行記錄外,還將在教程中進行討論。

簡而言之,您需要保持UpgradeCode不變,並隨機分配ProductCode。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM