我正在尝试检测以前安装的捆绑包的版本号是什么。但是,burn 似乎没有找到它,尽管它适当地检测到它将进行重大升级。
这就是我的 bundle 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>
想法是 ProductSearch 应该使用升级代码检测任何产品并将版本号放在变量中PreviousVersion
以供以后使用。但是,burn 似乎没有检测到具有此升级代码的任何现有产品,而是始终将版本设置为“ 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 升级代码,因为那个版本对我来说总是一样的。我更感兴趣的是为什么这不能像我想象的那样工作。