I'm trying to detect what the version number for a previously installed bundle is. However burn does not seem to find it, although it appropriately detects that it is going to do a major upgrade.
This is what the relevant parts of my bundle xml looks like:
<?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>
The thinking being that ProductSearch should detect any product using the upgrade code and place the version number in the variable PreviousVersion
for later use. However, burn does not seem to detect any existing product with this upgrade code, instead it always sets the version to "0.0.0.0
". Here are the relevant parts of the log file (somewhat edited for clarity):
...: 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
If I "manually" query for products using the upgrade code using MsiEnumRelatedProducts
I also cannot find it, whereas querying for the upgrade code from the msi package properly returns the msi product.
Are my expectations off? In this case, I can get away with querying for the msi upgrade code instead as that version will always be the same for me. I am more interested in why this does not work as I thought it would.
ProductSearch
and MsiEnumRelatedProducts
look for MSI packages, not Burn bundles. A custom bootstrapper application gets the version of the existing bundles in its OnDetectRelatedBundle
callback.