2016-08-11 26 views
0

我有以下問題,我試圖瞭解發生了什麼。我有此代碼:msi升級時,我將產品版本更改爲不同的格式失敗

... 
<Product Name="My Service" 
     Id="*" 
     UpgradeCode="$(var.UpgradeCode)" 
     Language="$(var.Language)" 
     Codepage="$(var.CodePage)" 
     Version="$(var.ProductVersion)" 
     Manufacturer="$(var.Manufacturer)"> 

    <Package Id="*" 
     Keywords="Installer" 
     Description="My Service Installer" 
     Comments="Service Installer" 
     Manufacturer="$(var.Manufacturer)" 
     InstallerVersion="300" 
     Languages="$(var.Language)" 
     Compressed="yes" 
     SummaryCodepage="$(var.CodePage)" /> 

    <Upgrade Id="$(var.UpgradeCode)"> 

    <!-- Populate NEWERVERSIONDETECTED if there is an installed 
     package with the same upgrade code 
     and version is > the version being installed --> 
     <UpgradeVersion Minimum="$(var.ProductVersion)" 
        IncludeMinimum="no" 
        OnlyDetect="no" 
        Property="NEWERVERSIONDETECTED" /> 

    <!-- Populate UPGRADEFOUND if there is an installed 
     package with the same upgrade code 
     and the version is between the earliest version defined 
     and the version being installed --> 
     <UpgradeVersion Minimum="$(var.FirstVersion)" 
        IncludeMinimum="yes" 
        Maximum="$(var.ProductVersion)" 
        IncludeMaximum="no" 
        Property="PREVIOUSVERSIONSINSTALLED" /> 
    </Upgrade> 

    <Condition Message="A newer version is already installed.">NOT NEWERVERSIONDETECTED</Condition> 

    <InstallExecuteSequence> 
     <RemoveExistingProducts Before="InstallInitialize" /> 
    </InstallExecuteSequence> 

<!-- Step 1: Define the directory structure --> 
... 
<!-- Step 2: Add files to your installer package --> 
... 
<!-- Step 3: Tell WiX to install the files --> 
... 

ProductVersion和FirstVersion具有x.x.x格式。由於msi僅包含3個文件,我更願意卸載所有內容並將新文件放在適當的位置(如主要升級)。 這是它發生了什麼: FirstVersion被定義爲「0.0.1」;我構建兩次我的項目(爲第一次構建產生兩個msi,ProductVersion爲「0.0.2」,第二次爲「0.0.3」)。當我在0.0.2上安裝0.0.3時,一切都很順利。在「添加/刪除程序」中,我看到已安裝的新版本,「我的服務」已上線&在本地服務中運行,在程序文件中我看到包含新文件的文件夾。

如果我使用ProductVersion 2.0.2和2.0.3(與前面的步驟相同)構建項目,當我在2.0.2之上安裝2.0.3時,沒有彈出錯誤,安裝結束成功(至少事件查看器是這麼說的)但我的Program Files文件夾不存在,我的服務在本地服務中是未知的(它不會啓動)。唯一看起來不錯的是添加/刪除程序,它向我顯示安裝了新版本2.0.3。另一個奇怪的事實是,我可以從添加/刪除程序中成功卸載我的應用程序。沒有錯誤!

那麼爲什麼0.0.x格式的ProductVersion升級工作正常,但 不適用於2.0.x?

我試圖在升級過程中記錄msiexec的輸出,但這對我來說太複雜了。 PS:不建議另一種實現升級的方式。我需要堅持 這個代碼,因爲我使用的msitools有很多限制。

回答

0

版本是正確的,你沒有犯任何錯誤。

沒有verbose log您發現問題的機率非常小。這並不難。按照上面的鏈接,你會發現多種方法的例子來生成一個日誌,並與我們分享或嘗試to read it做你自己。

相關問題