title: Detect .NET Framework 4.5.1 using WiX
body: <p>I'm creating an installer project in my solution using WiX 3.8.  As part of this install I create some launch conditions, one of which is checking that Microsoft .NET Framework 4.5.1 is installed.</p>
  
  <p>To do this I want to use some of the properties in the WixNetFxExtension lib which seem to work fine for older versions of the .NET framework.  There is an example of how to do this on <a href="http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/check_for_dotnet.html" rel="noreferrer">http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/check_for_dotnet.html</a>  This doesn't work for .NET 4.5.1 however as there is no NETFRAMEWORK451 property to check.</p>
  
  <p>Looking at the source for the NetFx451.wxs module (<a href="http://wix.codeplex.com/SourceControl/latest#src/ext/NetFxExtension/wixlib/NetFx451.wxs" rel="noreferrer">http://wix.codeplex.com/SourceControl/latest#src/ext/NetFxExtension/wixlib/NetFx451.wxs</a>) it appears that there is no separate property to use for .NET 4.5.1, but rather it also uses the same NETFRAMEWORK45.  As I understand it, v4.5.1 is an in-place upgrade for v4.5, so it uses the same registry keys (I think).  Anyway, in that module, they simply check the version number returned from NETFRAMEWORK45 as follows:</p>
  
  <pre><code>DetectCondition="NETFRAMEWORK45 &amp;gt;= $(var.NetFx451MinRelease)"
  </code></pre>
  
  <p>So I assumed that I could just write a condition like the following:</p>
  
  <pre><code>    &lt;PropertyRef Id="NETFRAMEWORK45" /&gt;
      &lt;Condition Message="The .NET Framework 4.5.1 was not found.  Stopping installation."&gt;
         &lt;![CDATA[Installed OR (NETFRAMEWORK45 &gt;= 378675)]]&gt;
      &lt;/Condition&gt;
  </code></pre>
  
  <p>But, this returned the error message on a machine that I know has the .NET Framework 4.5.1 installed. So I created a condition like this so I could just see the version number being returned from the registry:</p>
  
  <pre><code>    &lt;PropertyRef Id="NETFRAMEWORK45" /&gt;
      &lt;Condition Message ="[NETFRAMEWORK45]"&gt;0&lt;/Condition&gt;
  </code></pre>
  
  <p>This shows a message box with the following text:  #378758   So I know that the value in the registry is correct.</p>
  
  <p>So I am a bit confused why my condition failed.  Is there something obvious I am missing here, or is there some other way to compare that value in the condition element?</p>
  
  <p>Here is the fix to include the hash symbol as suggested by PhilDW:</p>
  
  <pre><code>    &lt;PropertyRef Id="NETFRAMEWORK45" /&gt;
      &lt;Condition Message="The .NET Framework 4.5.1 was not found.  Stopping installation."&gt;
        &lt;![CDATA[Installed OR (NETFRAMEWORK45 &gt;= "#378675")]]&gt;
      &lt;/Condition&gt;
  </code></pre>