I'm building a WiX bundle. I need to chain an executable package (actually ASCOM Platform 6 SP1). The detection condition is that a certain registry key exists, and contains a version number greater than a certain minimum required version. If those conditions are not met, then the prerequisite is not met and the EXE file package needs to be downloaded and installed.
The fragment I've authored looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<?include $(sys.CURRENTDIR)\Config.wxi?>
<!-- Define a prerequisite for ASCOM Platform 6 SP1 -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<util:RegistrySearch Id="FindAscom6Installed"
Variable="AscomPlatform6Installed"
Root="HKLM"
Key="SOFTWARE\ASCOM\Platform"
Value="Platform Build"
Result="exists"
Win64="$(var.Win64)"
/>
<util:RegistrySearch Id="FindAscom6Build"
Variable="AscomPlatformBuild"
Root="HKLM"
Key="SOFTWARE\ASCOM\Platform"
Value="Platform Build"
Result="value"
Win64="$(var.Win64)"
/>
<PackageGroup Id="AscomPlatform6Sp1">
<!-- If necessary, install ASCOM Platform version 6, do not uninstall
it during driver uninstall. -->
<!-- DetectCondition="AscomPlatformInstalled AND AscomPlatformBuild >= 6.0.10028.2207" -->
<ExePackage
SourceFile="ASCOMPlatform6SP1.exe"
DetectCondition="AscomPlatform6Installed AND AscomPlatformBuild >= 6.0.10028.2207"
DownloadUrl="http://download.ascom-standards.org/ASCOMPlatform6SP1.exe"
PerMachine="yes"
Permanent="yes"
Vital="yes" />
</PackageGroup>
</Fragment>
</Wix>
This compiles OK but when the setup is run, it fails. Here's the log output:
[0E54:141C][2012-12-12T06:37:38]i001: Burn v3.7.1204.0, Windows v6.2 (Build 9200: Service Pack 0), path: C:\Users\Tim\Documents\visual studio 2012\Projects\Wix.BurnTutorial\Wix.BurnTutorial\bin\Debug\Wix.BurnTutorial.exe, cmdline: ''
[0E54:141C][2012-12-12T06:37:38]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\Tim\AppData\Local\Temp\Wix.BurnTutorial_20121212063738.log'
[0E54:141C][2012-12-12T06:37:38]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\Tim\Documents\visual studio 2012\Projects\Wix.BurnTutorial\Wix.BurnTutorial\bin\Debug\Wix.BurnTutorial.exe'
[0E54:141C][2012-12-12T06:37:38]i000: Setting string variable 'WixBundleName' to value 'Wix.BurnTutorial'
[0E54:141C][2012-12-12T06:37:39]i100: Detect begin, 2 packages
[0E54:141C][2012-12-12T06:37:39]i000: Registry key not found. Key = 'SOFTWARE\ASCOM\Platform'
[0E54:141C][2012-12-12T06:37:39]i000: Registry key not found. Key = 'SOFTWARE\ASCOM\Platform'
[0E54:141C][2012-12-12T06:37:39]i000: Setting numeric variable 'AscomPlatform6Installed' to value 0
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to parse condition "AscomPlatform6Installed AND AscomPlatformBuild >= 6.0.10028.2207". Unexpected character at position 51.
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to read next symbol.
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to parse value.
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to parse term.
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to parse boolean-factor.
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to parse boolean-term.
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to parse boolean-term.
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to parse expression.
[0E54:141C][2012-12-12T06:37:39]e051: Error 0. Failed to parse condition AscomPlatform6Installed AND AscomPlatformBuild >= 6.0.10028.2207. Unexpected symbol at position (null)
[0E54:141C][2012-12-12T06:37:39]e000: Error 0x8007000d: Failed to evaluate executable package detect condition.
[0E54:141C][2012-12-12T06:37:39]e151: Detect failed for package: ASCOMPlatform6SP1.exe, error: 0x8007000d
[0E54:141C][2012-12-12T06:37:39]i101: Detected package: ASCOMPlatform6SP1.exe, state: Unknown, cached: None
[0E54:141C][2012-12-12T06:37:39]i101: Detected package: TargetPackage, state: Absent, cached: None
[0E54:141C][2012-12-12T06:37:39]i199: Detect complete, result: 0x8007000d
I suspect the problem might be that, because the key doesn't exist, then AscomPlatform6Build is null, which WiX doesn't like.
How do I correctly construct this detection condition?
You should be able to add a condition to the second RegistrySearch based off the first one. If you assign a base value to the AscomPlatformBuild
as well, it won't be reported as null.
<Variable Name="AscomPlatformBuild" Type="numeric" Value="1.0.0" />
...
<util:RegistrySearch Id="FindAscom6Build"
Variable="AscomPlatformBuild"
Root="HKLM"
Key="SOFTWARE\ASCOM\Platform"
Value="Platform Build"
Result="value"
Win64="$(var.Win64)"
Condition="AscomPlatform6Installed" />
The ExePackage can be left alone.
Faced the same issue. Resolved it by adding v before the version constant in the condition .i.e v6.0.10028.2207
<ExePackage
SourceFile="ASCOMPlatform6SP1.exe"
DetectCondition="AscomPlatform6Installed AND AscomPlatformBuild >= v6.0.10028.2207"
DownloadUrl="http://download.ascom-standards.org/ASCOMPlatform6SP1.exe"
PerMachine="yes"
Permanent="yes"
Vital="yes" />
User contributions licensed under CC BY-SA 3.0