2015-11-02 60 views
1

我試圖檢測以前安裝的捆綁軟件的版本號是多少。然而,儘管它能夠適當地檢測到它會進行重大升級,但似乎並沒有發現它。使用Wix Burn檢測以前的捆綁版本

這是我的包XML的相關部分的樣子:

<?define BUNDLE_UPGRADE_CODE=my_upgrade_code_guid?> 

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 

    <Bundle UpgradeCode="$(var.BUNDLE_UPGRADE_CODE)" DisableModify="yes" ...> 

    <util:ProductSearch UpgradeCode="$(var.BUNDLE_UPGRADE_CODE)" Variable="PreviousVersion" /> 

    <BootstrapperApplicationRef ... /> 

    <Chain> 
     <ExePackage Id="my_exe_package".../> 
     <MsiPackage Id="my_msi_package" .../> 
    </Chain> 
    </Bundle> 
</Wix> 

的思想在於產品搜索應該使用升級代碼檢測到任何產品,並把版本號在變量PreviousVersion供以後使用。但是,刻錄似乎無法檢測到任何具有此升級代碼的現有產品,而是始終將版本設置爲「0.0.0.0」。以下是日誌文件(有些編輯的清晰度)的相關部分:

...: Detect begin, 2 packages 
...: Product or related product not found: {my_upgrade_code_guid} 
...: Setting version variable 'PreviousVersion' to value '0.0.0.0' 
...: Detected related bundle: {previous_bundle_product_code}, type: Upgrade, scope: PerMachine, version: 1.0.0.0, operation: MajorUpgrade 
...: Detected related package: {previous_msi_product_code}, scope: PerMachine, version: 1.0.0.0, language: 0 operation: MajorUpgrade 
...: Detected package: my_exe_package, state: Absent, cached: Complete 
...: Detected package: my_msi_package, state: Absent, cached: None 
...: Detect complete, result: 0x0 
...: Plan begin, 2 packages, action: Install 
...: Skipping dependency registration on package with no dependency providers: my_exe_package 
... 
...: Planned package: my_exe_package, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: None, cache: No, uncache: No, dependency: None 
...: Planned package: my_msi_package, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register 
...: Planned related bundle: {previous_bundle_product_code}, type: Upgrade, default requested: Absent, ba requested: Absent, execute: Uninstall, rollback: Install, dependency: None 
...: Plan complete, result: 0x0 

如果我「手動」查詢使用升級代碼使用MsiEnumRelatedProducts我也找不到它的產品,而查詢從升級代碼msi包正確返回msi產品。

我的期望是否關閉?在這種情況下,我可以避開查詢msi升級代碼,因爲該版本對我而言始終是相同的。我更感興趣的是爲什麼這不起作用,因爲我認爲它會。

回答

3

ProductSearchMsiEnumRelatedProducts尋找MSI包,而不是燒傷包。自定義引導程序應用程序在其OnDetectRelatedBundle回調中獲取現有捆綁軟件的版本。