title: How to use Microsoft.Build in .NET Core project?
body: <p>I have the following issue trying to programmatically build a <code>.vcxproj</code> from a C# test.</p>
  
  <pre><code>System.TypeLoadException : Could not load type 'Microsoft.Build.Framework.IProjectElement' from assembly 'Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
     at Microsoft.Build.Evaluation.ProjectRootElementCache..ctor(Boolean autoReloadFromDisk)
     at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary`2 globalProperties, IEnumerable`1 loggers, IEnumerable`1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCount, Boolean onlyLogCriticalEvents) in E:\A\_work\82\s\src\Build\Definition\ProjectCollection.cs:line 307
     at Microsoft.Build.Evaluation.ProjectCollection..ctor() in E:\A\_work\82\s\src\Build\Definition\ProjectCollection.cs:line 252
  </code></pre>
  
  <p>This happens as soon as my code reaches the very first <code>new ProjectCollection()</code> expression. I have added the following lines to my <code>.csproj</code> file.</p>
  
  <pre><code>&lt;PackageReference Include="Microsoft.Build" Version="15.6.85" /&gt;
  </code></pre>
  
  <p>Why is it looking for version 14 for <code>Microsoft.Build.Framework</code>? Why can't it load it. I'm on Visual Studio 2017, I get the same results from the <code>dotnet test</code> command.</p>