我正在为我的软件创建一个较新的版本安装程序,并计划使用它来升级旧版本。启动新版本安装程序时,我需要获取旧版本软件的版本号并将其放入变量中以备将来使用。
我尝试用以下代码搜索注册表,但未捕获任何内容。
<Bundle Name="$(var.ProductName)" Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
IconSourceFile="A1-Logo-4.ico"
UpgradeCode="$(var.BundleUpgradeCode)">
<util:RegistrySearch Id="EXISTS_CURRENT_LANGUAGE_PACKAGE"
Root="HKLM"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Value="BundleUpgradeCode"
Variable="EXISTS_CURRENT_LANGUAGE_PACKAGE"
Result="exists"/>
我可以检测到wix内置变量[WixBundleInstalled]已安装了我的软件的旧版本,并且可以在安装程序日志中看到旧版本软件的版本号。安装日志如下所示。
[0E64:0C48][2019-04-23T13:43:40]i001: Burn v3.11.1.2318, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Users\XXX\AppData\Local\Temp\{XXXX-4C15-4659-BFBF-XXXX}\.cr\XXXX_v11.26.4.3.exe
[0E64:0C48][2019-04-23T13:43:40]i000: Initializing string variable 'INSTALL_BUTTON_TEXT' to value 'Install'
[0E64:0C48][2019-04-23T13:43:40]i009: Command Line: '-burn.clean.room=C:\installer\XXXX_v11.26.4.3.exe -burn.filehandle.attached=200 -burn.filehandle.self=208'
[0E64:0C48][2019-04-23T13:43:40]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\installer\XXXX_v11.26.4.3.exe'
[0E64:0C48][2019-04-23T13:43:40]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\installer\'
[0E64:0C48][2019-04-23T13:43:40]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\XXX\AppData\Local\Temp\XXXX_20190423134340.log'
[0E64:0C48][2019-04-23T13:43:40]i000: Setting string variable 'WixBundleName' to value 'XXXX'
[0E64:0C48][2019-04-23T13:43:40]i000: Registry value not found. Key = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\', Value = 'BundleUpgradeCode'
[0E64:0C48][2019-04-23T13:43:40]i000: Setting numeric variable 'EXISTS_CURRENT_LANGUAGE_PACKAGE' to value 0
[0E64:0C48][2019-04-23T13:43:40]i102: Detected related bundle: {XXXX-a9f2-420d-918b-XXXX}, type: Upgrade, scope: PerMachine, version: 11.26.4.2, operation: MajorUpgrade
[0E64:0C48][2019-04-23T13:43:40]i101: Detected package: InstallationMSI, state: Absent, cached: None
[0E64:0C48][2019-04-23T13:43:40]i104: Detected package: InstallationMSI, feature: ProductFeature, state: Absent
[0E64:0C48][2019-04-23T13:43:40]i052: Condition 'XXX OR XXXX OR XXXXX' evaluates to true.
[0E64:0C48][2019-04-23T13:43:40]i199: Detect complete, result: 0x0
我正在获取一种方法来获取已安装捆绑软件的版本号。或任何解决方案将不胜感激。有什么想法吗?