title: Microsoft.Build.Engine Error (default targets): Target GetFrameworkPaths: Could not locate the .NET Framework SDK
body: <p>I am writing a webservice, that when called should build a C# project. I'm using the framework 2 reference, Microsoft.Buld.Engine and Microsoft.Build.Framework. If you look under the '&lt;Import&gt;' section .csproj file, by default it has:</p>
  
  <pre><code>&lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /&gt;
  </code></pre>
  
  <p>which I then changed to:</p>
  
  <pre><code>&lt;Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /&gt;
  </code></pre>
  
  <p>My code to build the csproj is:</p>
  
  <pre><code>Engine buildEngine = new Engine(Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), @"Microsoft.NET\Framework\v2.0.50727"));
  FileLogger logger = new FileLogger();
  logger.Parameters = @"logfile=c:\temp\build.log";
  buildEngine.RegisterLogger(logger);
  
  bool success = buildEngine.BuildProjectFile([Path_Of_Directory]+ "ProjectName.csproj");
  buildEngine.UnregisterAllLoggers();
  </code></pre>
  
  <p>The success variable returns a false because the build faild. I then check the build.log file and this is the error I recieve:</p>
  
  <blockquote>
    <p>Build started 3/17/2010 11:16:56 AM
    Project
    "[Path_Of_Directory]\ProjectName.csproj"
    (default targets): Target
    GetFrameworkPaths: Could not locate
    the .NET Framework SDK. The task is
    looking for the path to the .NET
    Framework SDK at the location
    specified in the SDKInstallRootv2.0
    value of the registry key
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework.
    You may be able to solve the problem
    by doing one of the following: 1.)
    Install the .NET Framework SDK. 2.)
    Manually set the above registry key to
    the correct location. Target</p>
  </blockquote>
  
  <p>I cant understand why it wont build. Any help will be much appreciated. Thanks</p>