spottedmahn
spottedmahn

Reputation: 15981

The current .NET SDK does not support targeting .NET Core 2.0

I'm trying to build aspnet\mvc and I'm receiving the following error after running build.cmd /t:Restore from the cmd line per the instructions here.

The current .NET SDK does not support targeting .NET Core 2.0. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.0.

According to dotnet --info I have the 2.0.2. Is that not a high enough version?

dotnet sdk version screenshot

What am I doing wrong?

Upvotes: 4

Views: 4360

Answers (1)

Salaros
Salaros

Reputation: 1456

Try checking your global.json file in the root of the project/solution. I had the same problem when opened a old .NET Core project and tried to compile it in multi-target mode for both .NET Standard 1.6 and 2.0.

{ 
  "projects": ["src", "tests"], 
  "sdk": { 
    "version": "1.0.0-preview2-003131"
  } 
}

Since I had .MET Core SDK 2.0.3 installed I just changed the version property to

"version": "2.0.3"

You might also remove global.json file completely, since it considered deprecated after .NET 1.0 => 1.1 migration and project.json / runtimeconfig.json / global.json / hosting.json / .. infrastructure being dropped in favor of .csproj format.

You can try replacing it with

<RuntimeFrameworkVersion>2.0.3</RuntimeFrameworkVersion>

for every project.

However some people suggest avoid using both global.json and <RuntimeFrameworkVersion> for painless .NET Core SDK/Runtime updates.

Upvotes: 2

Related Questions