title: In WiX, how do I test if the installed version is at least a specific version?
body: <p>I'm building a <a href="http://wixtoolset.org/documentation/manual/v3/bundle/" rel="nofollow">WiX bundle</a>. I need to chain an executable package (actually <a href="http://en.wikipedia.org/wiki/ASCOM_%28standard%29" rel="nofollow">ASCOM</a> 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.</p>
  
  <p>The fragment I've authored looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?include $(sys.CURRENTDIR)\Config.wxi?&gt;
  
  &lt;!-- Define a prerequisite for ASCOM Platform 6 SP1 --&gt;
  
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
       xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"&gt;
      &lt;Fragment&gt;
          &lt;util:RegistrySearch Id="FindAscom6Installed"
                               Variable="AscomPlatform6Installed"
                               Root="HKLM"
                               Key="SOFTWARE\ASCOM\Platform"
                               Value="Platform Build"
                               Result="exists"
                               Win64="$(var.Win64)"
                               /&gt;
          &lt;util:RegistrySearch Id="FindAscom6Build"
                               Variable="AscomPlatformBuild"
                               Root="HKLM"
                               Key="SOFTWARE\ASCOM\Platform"
                               Value="Platform Build"
                               Result="value"
                               Win64="$(var.Win64)"
                               /&gt;
          &lt;PackageGroup Id="AscomPlatform6Sp1"&gt;
              &lt;!-- If necessary, install ASCOM Platform version 6, do not uninstall
                   it during driver uninstall. --&gt;
  
              &lt;!-- DetectCondition="AscomPlatformInstalled AND AscomPlatformBuild &gt;= 6.0.10028.2207" --&gt;
              &lt;ExePackage
                 SourceFile="ASCOMPlatform6SP1.exe"
                 DetectCondition="AscomPlatform6Installed AND AscomPlatformBuild &gt;= 6.0.10028.2207"
                 DownloadUrl="http://download.ascom-standards.org/ASCOMPlatform6SP1.exe"
                 PerMachine="yes"
                 Permanent="yes"
                 Vital="yes" /&gt;
          &lt;/PackageGroup&gt;
      &lt;/Fragment&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p>This compiles OK but when the setup is run, it fails. Here's the log output:</p>
  
  <pre><code>[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 &gt;= 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 &gt;= 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
  </code></pre>
  
  <p>I suspect the problem might be that, because the key doesn't exist, then <em>AscomPlatform6Build</em> is null, which WiX doesn't like.</p>
  
  <p>How do I correctly construct this detection condition?</p>