2010-02-15 179 views
15

我正在努力啓用WiX的主要升級功能。如何讓WiX主要升級工作?

我想安裝的每一個新版本是一個重大升級(完全卸載,然後安裝新的),因爲我們不想讓不同的升級和全新安裝的版本。

我開始嘗試使用該標籤的東西做了,但我一直得到「安裝了另一個版本。」我運行安裝程序時出現錯誤消息。

因此,我實施了V3.5中添加的新標籤,以便升級。我仍然收到錯誤消息。

然後我讀的地方,你需要更改ID GUID爲每個新版本。所以我設置了Id =「*」來讓WiX生成它們。

現在,當我安裝它不卸載舊版本的新版本,而你最終有兩個安裝到同一個文件夾中。我解決了這個問題,因爲運行MSI(新的或舊的)會啓動修復/刪除屏幕。

此外,程序沒有被新版本覆蓋。

這裏是我的WiX的腳本的開頭:

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 

    <Product Id="*" 
      Name="Foo" 
      Language="1033" 
      Codepage="1252" 
      Version="!(bind.FileVersion.Foo.exe)" 
      Manufacturer="Foo Bar Ltd." 
      UpgradeCode="dac2fab2-7d76-4e47-b25f-0748380dab81"> 

     <Package 
       Description="Foo" 
       Comments="This installer database contains the logic and data required to install Foo." 
       InstallerVersion="300" 
       Languages="1033" 
       SummaryCodepage="1252" 
       Platform="x86" 
       Compressed="yes" /> 

     <!-- Remove older versions --> 
     <!-- Important note: MSI ignores the last version digit 1.0.0.? when comparing versions, so always change at least the 3rd digit for new external releases--> 
     <MajorUpgrade DowngradeErrorMessage="The version currently installed is newer than the version you are attempting to install."/> 

回答

20

這裏是什麼,我用我所有的包片斷,提煉了許多內部和公開發行

<Product Id="*" 
     UpgradeCode="$(var.Property_UpgradeCode)" 
     Name="!(loc.ApplicationName)" 
     Language="!(loc.Property_ProductLanguage)" 
     Version="$(var.version)" 
     Manufacturer="!(loc.ManufacturerName)" > 

    <Package Description="!(loc.Package_Description) $(var.version)" 
      Comments="!(loc.Package_Comments)" 
      Manufacturer="!(loc.ManufacturerName)" 
      InstallerVersion="301" 
      Compressed="yes" 
      InstallPrivileges="elevated" 
      InstallScope="perMachine" 
      Platform="$(var.ProcessorArchitecture)" /> 

    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> 

    <Upgrade Id="$(var.Property_UpgradeCode)"> 
     <UpgradeVersion OnlyDetect="yes" 
         Minimum="$(var.version)" 
         Property="NEWERVERSIONDETECTED" 
         IncludeMinimum="no" /> 

     <UpgradeVersion OnlyDetect="no" 
         Maximum="$(var.version)" 
         Property="OLDERVERSIONBEINGUPGRADED" 
         IncludeMaximum="no" /> 

     <!-- Detect for changes in 4th field only --> 
     <UpgradeVersion Property="ANOTHERBUILDINSTALLED" 
       Maximum="$(var.version)" Minimum="$(var.version)" 
       IncludeMinimum="yes" IncludeMaximum="yes" OnlyDetect="yes" /> 

    </Upgrade> 

    <CustomAction Id="CA_BlockOlderVersionInstall" Error="!(loc.LaunchCondition_LaterVersion)" /> 
    <CustomAction Id="CA_BlockAnotherBuildInstall" Error="!(loc.LaunchCondition_AnotherBuild)" /> 

    <InstallExecuteSequence> 
     <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts"> 
      <![CDATA[NEWERVERSIONDETECTED]]> 
     </Custom> 

     <!-- Prevent installation on 4th version field change only --> 
     <Custom Action="CA_BlockAnotherBuildInstall" After="FindRelatedProducts"> 
      <![CDATA[ANOTHERBUILDINSTALLED]]> 
     </Custom> 

     <LaunchConditions After="AppSearch" /> 

     <!-- Schedule RemoveExistingProducts early --> 
     <RemoveExistingProducts After="InstallInitialize" /> 
    </InstallExecuteSequence> 

    <InstallUISequence> 
     <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts"> 
      <![CDATA[NEWERVERSIONDETECTED]]> 
     </Custom> 

     <!-- Prevent installation on 4th version field change only --> 
     <Custom Action="CA_BlockAnotherBuildInstall" After="FindRelatedProducts"> 
      <![CDATA[ANOTHERBUILDINSTALLED]]> 
     </Custom> 

     <LaunchConditions After="AppSearch" /> 
    </InstallUISequence> 

    <!-- .... --> 

</Product> 
1

我知道這個帖子是舊的和回答,但是,如果有人遇到這種情況,我有我的升級安裝程序的問題。升級部分都很好。安裝程序將運行,但是,以前的版本從未刪除,因此,未安裝新版本。問題是這個

<Feature Id="ProductBinaries" Title="ProductBinariesInstaller" Level="0"> 

水平= 「0」 以上,應該是等級= 「1」,因爲它是如下:

<Feature Id="ProductBinaries" Title="ProductBinariesInstaller" Level="1"> 

斯科特

1

如果它是任何使用到那些發現這個主題的人,我也遇到了一個我剛纔發現的類似問題。

在我的情況下(和仍然在發展我安裝的早期階段),關鍵的區別是,版本之間,我從每個用戶安裝到每臺機器安裝切換。更具體地講,我已經添加了下面一行到我Product.wxs:

<Property Id='ALLUSERS' Value='1'/> 

我還是讓我的頭周圍許多Windows安裝程序的特質的,但我認爲通過切換類型以這種方式進行安裝可以在許多方面轉向相互獨立的版本控制流(甚至可以並行安裝兩個相同的版本!)。

這是一個恥辱,Windows控制面板並沒有明確,也就是每用戶安裝和全區分用戶。