MSBuild fails for .NET Core SDK Version 2.2.202

14,728

Solution 1

Updating Visual Studio to the minimum supported version or above should fix this problem.

Some .NET Core versions also include fixes in MSBuild. They are distributed together with Visual Studio.

They put the minimum supported versions in the release notes of .NET Core.

For example: Announcing .NET Core 2.2 | .NET Blog

Solution 2

.NET Core SDK versions 2.2.2XX and 2.1.6XX are intended to be used with Visual Studio 2019 and MSBuild 16.x.

.NET Core SDK versions for Visual Studio 2017 are 2.2.1XX and 2.1.5XX.

See this GitHub issue for more details.

Solution 3

For people coming here because they have the in Azure DevOps Pipelines - here some pointers for that.

If you have a private agent pool configured (e.g. private build machine), you might want to update your machine to support a more recent MSBuild version. See other answers.

If you don't have configured a build agent and use a default agent pool provided by Azure DevOps itself (e.g. "Hosted" or VS2019), see if there is a newer Hosted one that supports your configuration. See screenshot below where to look.

Select an Agent pool in the "Run pipeline" step

Share:
14,728

Related videos on Youtube

Hamzawey
Author by

Hamzawey

Software Developer, Researcher and Engineer

Updated on June 04, 2022

Comments

  • Hamzawey
    Hamzawey almost 2 years

    After downloading and installing Visual Studio 2019 RC, I cannot run msbuild, and get the following error:

    "Version 2.2.202 of the .NET Core SDK requires at least version 16.0.0 of MSBuild. The current available version of MSBuild is 15.6.82.30579. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available."

    I cannot find MSBuild version 16. The only version I find is this one here: "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0"

    • Matthiee
      Matthiee about 5 years
      Have you tried updating your Visual Studio?
    • Hamzawey
      Hamzawey about 5 years
      Yep, when I updated it now, it worked. Thanks @Matthiee
  • Eric Olsson
    Eric Olsson over 4 years
    Thank you for this info. I was uninstalling "old" SDKs, and I found that I could no longer build a solution at work that still needed MSBuild 15.x. Having those version number ranges was a huge timesaver!
  • Marie
    Marie about 4 years
    Do Visual Studio versions related directly to Microsoft.Build versions?
  • Marie
    Marie about 4 years
    Changing random required versions without knowing what they are used for or what the down stream effects are is a terrible idea. That may come back to bite you
  • Matthiee
    Matthiee about 4 years