2013-10-18 37 views
8

這裏是場景。Wix MajorUpgrade問題

1)安裝1.0.1.1然後升級到1.0.2.2 ===>這非常適用(如預期)

2.)安裝1.0.2.2然後降級到1.0.1.1 ===>此不工作(如預期)

3.)安裝1.0.1.1然後安裝1.0.1.1 ===>此進入修復/刪除模式(如預期)

4.)安裝1.0.1.1然後安裝1.0.1.2 ===>它安裝得像一個新的,並在控制面板的添加/刪除程序中顯示程序兩次(我想它應該像3.),因爲根據我的理解,MSI不在乎產品版本的第四部分)

我做錯了什麼?

<Product Id="*" Name="My product" Version="$(var.Version)" Language="1033" Manufacturer="My Company" UpgradeCode="MY-UPGRADE-CODE"> 

<Package Description="My product" Comments="Comments" InstallerVersion="200" Compressed="yes" /> 

<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." /> 
+0

參見本[相關問題](http://stackoverflow.com/questions/16642518/wix-can-we-upgrade-1-0-0-0-to-1- 0-0-1-而變化的產品代碼)。 – CodeFox

回答

19

這是WIX文檔中提到的行爲。您需要在MajorUpgrade元素中將下面的屬性設置爲「Yes」來處理這種情況。閱讀突出顯示的文字以獲取更多詳情

AllowSameVersionUpgrades(YesNoType)

當設置爲NO(缺省),安裝使用相同版本的產品和升級代碼(但不同的產品代碼)是允許的,由微星兩款產品進行處理。當設置爲yes時,WiX設置msidbUpgradeAttributesVersionMaxInclusive屬性,該屬性告訴MSI將具有相同版本的產品視爲主要升級。

This is useful when two product versions differ only in the fourth version field. MSI specifically ignores that field when comparing product versions, so two products that differ only in the fourth version field are the same product and need this attribute set to yes to be detected.

注意,因爲MSI忽略了第四個版本的產品領域,設置該屬性是還允許降級時的前三個產品版本字段是相同的。例如,產品版本1.0.0.1將「升級」1.0.0.2998,因爲它們被視爲相同版本(1.0.0)。這可能會重新引入嚴重的錯誤,所以最安全的選擇是更改前三個版本字段並省略此屬性以獲取缺省值no。

當AllowDowngrades也爲「是」時,此屬性不能爲「是」 - AllowDowngrades已允許具有相同版本號的兩個產品互相升級。

來源:WIX Documentation