title: How to specify MSBuild version in nant script?
body: <p>I have a nant script that in one of its targets uses the msbuild tags to build a Visual Studio 2010 solution.</p>
  
  <p>The problem is it fails when it hits this point, the error is:</p>
  
  <pre><code>Solution file error MSB5014: File format version is not recognized.  MSBuild can only read solution files between versions 7.0 and 9.0, inclusive.
  
  Failed to start MSBuild.
  
  External Program Failed:  C:\Windows\Microsoft.NET\Framework\v2.0.50727\msbuild.exe (return code was 1)
  </code></pre>
  
  <p>The error makes sense, if it's calling the .NET 2.0 version of MSBuild it won't compile the VS2010 solution.  However, I can't figure out how to get it to call the right version of MSBuild.</p>
  
  <p>If I run 'where MSBuild' (from the same VS2010 Command Prompt that the build script failed in), I get:</p>
  
  <pre><code> C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
   C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
  </code></pre>
  
  <p>If I run 'msbuild /version' (again, same window) I get:</p>
  
  <pre><code> Microsoft (R) Build Engine version 4.0.30319.17929
   [Microsoft .NET Framework, version 4.0.30319.18034]
   Copyright (C) Microsoft Corporation. All rights reserved.
  
   4.0.30319.17929
  </code></pre>
  
  <p>So everything looks like it should be using the 4.0 version, but it's not.  Any idea what gives?  I know I've addressed this issue before, but can't remember what it was to save my life.</p>