I am having issues with the above error message when running build with the latest .nuget packages installed. I am trying to build a project, not solution. When I use Microsoft.Build version 14.3.0 I don't see this problem.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Build" version="15.1.548" targetFramework="net461" />
<package id="Microsoft.Build.Framework" version="15.1.548" targetFramework="net461" />
<package id="Microsoft.Build.Runtime" version="15.1.548" targetFramework="net461" />
<package id="Microsoft.Build.Tasks.Core" version="15.1.548" targetFramework="net461" />
<package id="Microsoft.Build.Utilities.Core" version="15.1.548" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.3.1" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Globalization" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
<package id="System.Threading.Thread" version="4.3.0" targetFramework="net461" />
</packages>
To get this far I had to add assembly binding:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
Please help, I will be happy to provide more details.
Can you verify that Microsoft.Build.Utilities.Core.dll is in your output folder?
Thank you for responding. I have changed to use msbuild.exe from command line instead so moved on already.
I hit the same error after I installed:
Install-Package Microsoft.Build -Version 15.1.1012
But then I installed:
Install-Package Microsoft.Build.Utilities.Core -Version 15.1.1012
And things started working.
A little confusing...
Related SO question popped up: https://stackoverflow.com/questions/44249320/build-project-with-microsoft-build-api
Possible better solution for current versions of Microsoft.Build components:
https://stackoverflow.com/a/49886334/253938
https://github.com/dotnet/roslyn/issues/26029
Thank you. Worked for me too. But I'm really confused, I'm using .NET Framework 4.7.2 for TargetFramework.
Most helpful comment
I hit the same error after I installed:
Install-Package Microsoft.Build -Version 15.1.1012
But then I installed:
Install-Package Microsoft.Build.Utilities.Core -Version 15.1.1012
And things started working.
A little confusing...