title: InvalidProjectFileException with using Microsoft.NET.Sdk in Microsoft.Build.Evaluation
body: <p>I want to parse a C#-project to read out all project- and other references. For months, I used the <code>Microsoft.Build.Evaluation</code> namespace from the package <code>Microsoft.Build</code>.</p>
  <pre class="lang-cs prettyprint-override"><code>var file = Directory.GetFiles(rootDirectory, &quot;*.csproj&quot;).First();
  var project = new Project(test);
  </code></pre>
  <p>For the old csproj-files it is working fine without any problem. The old files are starting with</p>
  <p><code>&lt;Project ToolsVersion=&quot;4.0&quot; DefaultTargets=&quot;Build&quot; xmlns=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;&gt;</code></p>
  <p>Since migrating to the new SDK-Project style, I have some problems with reading the csproj files. They start with</p>
  <p><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;</code></p>
  <p>When loading the project I get the following exception: <code>InvalidProjectFileException: 'The SDK 'Microsoft.NET.Sdk' specified could not be found.</code> I figured out, if I change the Version of the package <code>Microsoft.Build</code> to the version of my Visual Studio/MSBuild (e.g. 16.8) it works fine. I have a lot of colleagues with a high variety of MSBuild Versions &gt;15 and we cannot have all the same MSBuild version.</p>
  <p>A possible solution which I have found is to add the <code>Microsoft.Build.Runtime</code> package but if I add it to my project I get a lot of compiler errors and no type is found which works before.</p>
  <p>The project which should load the csproj files is a <code>ToolsVersion=&quot;4.0&quot;</code>-project style with .NET Framework 4.7.2 (cannot change this to SDK project style because of massive T4 template usage).</p>