我有一個產品用於裝運.vdproj
安裝程序。在最新的版本中,我發佈了一個測試版,使用WiX完全重做安裝程序(作爲遷移到Visual Studio 2012的一部分,不再支持.vdproj)。不幸的是,當時我並不知道升級代碼應該在不同副本間保持一致,並且已經向其中一個測試版安裝程序發送了不同的升級代碼。在WiX中處理已更改的升級代碼,其中舊安裝程序允許每個用戶和每臺機器都使用
我希望我的安裝程序自動刪除使用.vdproj
安裝程序構建的以前版本以及作爲測試版副本發佈的版本。這是我到目前爲止已經得到:
<Product Id="{A4CBA9F9-D86B-400C-BD23-996B4367931A}" Name="Foo Viewer" Language="1033" Version="6.0.1.0" Manufacturer="Foo Corporation" UpgradeCode="43e024b8-b3ea-40a3-a854-2af83f207f0f">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes" />
<Feature Id="FOOVIEWERFeature" Title="Foo Viewer" Level="1" Description="The Foo Viewer GUI and CLI binaries." AllowAdvertise="no" Absent="disallow" Display="expand">
<!-- Stuff -->
</Feature>
<PropertyRef Id="NETFRAMEWORK40CLIENT" />
<Condition Message="Foo Viewer requires the .NET Framework 4.0 Client Profile or higher to run.">Installed OR NETFRAMEWORK40CLIENT</Condition>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="FooViewerInstallerUI" />
<UIRef Id="WixUI_ErrorProgressText" />
<Icon Id="FooViewerIcon" SourceFile="../FooViewer.ico" />
<Property Id="ARPPRODUCTICON" Value="FooViewerIcon" />
<!-- I got this upgrade code by opening one of the old .vdproj MSIs in Orca -->
<Upgrade Id="{80539F30-8176-4DCC-A102-ED32A34A91CB}">
<UpgradeVersion OnlyDetect="no"
Minimum="0.0.0.0"
IncludeMinimum="yes"
MigrateFeatures="no"
IgnoreRemoveFailure="no"
Property="UPGRADE_VDPROJ_FOOVIEWER"
/>
</Upgrade>
<Upgrade Id="{43e024b8-b3ea-40a3-a854-2af83f207f0f}">
<!-- Foo Viewer 6.0.0.0 (Beta) shipped with a version 5.3.0.0 in the installer. -->
<UpgradeVersion OnlyDetect="no"
Minimum="5.3.0.0"
Maximum="5.3.0.0"
IncludeMinimum="yes"
IncludeMaximum="yes"
MigrateFeatures="yes"
IgnoreRemoveFailure="no"
Property="UPGRADE_WIX_FOOVIEWER"
/>
<!-- Detect newer versions -->
<UpgradeVersion OnlyDetect="yes"
Minimum="6.0.1.0"
IncludeMinimum="no"
Property="NEW_VERSION_FOUND"/>
</Upgrade>
<Condition Message="A newer version of Foo Corporation Foo Viewer is already installed.">
Installed OR NOT NEW_VERSION_FOUND
</Condition>
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence>
</Product>
然而,儘管投入了舊安裝程序的升級代碼<upgrade>
元,老版是沒有得到清除。因此,新副本嘗試安裝在舊副本的頂部,然後兩個版本都不再工作。
Beta版和更新版本的檢測功能正常工作(<Upgrade
,帶有GUID {43e024b8-b3ea-40a3-a854-2af83f207f0f})。測試版本被卸載,如果我生成了一個「更新的」安裝程序,那麼當前的安裝程序無法正確安裝。也就是說,WiX安裝程序沒有問題相互檢測。
有沒有我在這裏做錯了,不會讓它檢測到舊的.vdproj
安裝的副本?
編輯:我的工具日誌當發生這種情況在安裝過程中,我得到如下:
Action start 17:25:47: FindRelatedProducts.
MSI (c) (10:B8) [17:25:47:269]: FindRelatedProducts: current install is per-machine. Related install for product '{2024FF03-D6F2-4065-A22B-80252B2A66B6}' is per-user. Skipping...
Action ended 17:25:47: FindRelatedProducts. Return value 1.
這似乎是準確的。舊安裝程序給出了「每用戶」或「每臺機器」的選項,而新安裝程序始終強制每臺機器。如果我在舊安裝程序中選擇「使用此計算機的所有人」,則新安裝程序能夠檢測到它。如果可能的話,我想在WiX中檢測任一選項。
「我希望你知道以前安裝的產品的ProductId。」< - 不。 :(「也許你在更改UpgradeCode時沒有改變產品代碼?」 - 我改變了他們兩個。或者說,我不知道其中的任何一個的重要性。在創作WiX版本的產品時,我生成了新的GUID installer;我不知道Visual Studio(以前的).vdproj系統是如何生成這些ID的 –
如果你有從.vdproj文件創建的MSI,那麼你可以很容易地找到PRoductCode,你可以使用ORCA來讀取MSI數據庫,或者您可以使用一些腳本(vbs)來讀取MSI數據庫 – Isaiah4110
@ AG_85:我沒有所有生產的MSIs –