Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The current .NET SDK does not support targeting .NET Standard 2.0 error in Visual Studio 2017 update 15.3

I want to create a class library project with Target Framework .NET Standard 2.0.

I've updated my Visual Studio 2017 to Version 15.3 and also in Visual Studio installer checked .NET Framework 4.7 SDK and .NET Framework 4.7 targeting pack manually and installed them.

There is still no .NET Standard 2.0 option in the Target Framework combo box in the Project/Application window. So I changed TargetFramework tag in .csproj file manually to netstandard2.0, but after trying to build I get this error:

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

like image 718
sahar Avatar asked Aug 17 '17 10:08

sahar


People also ask

Is .NET standard 2.0 still supported?

NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target. If you need to support . NET Standard 1. x, we recommend that you also target .

How do I change my default .NET SDK?

In order to change default dotnet SDK version, place a global. json file in the current folder or any parent folder with the contents below. You can create the global. json file manually, or use the dotnet cli command dotnet new globaljson .


1 Answers

It sounds like installing the VS2017 update for that specific version didn't also install the .NET Core 2.0 SDK. You can download that here.

To check which version of the SDK you've already got installed, run

dotnet --info

from the command line. Note that if there's a global.json file in either your current working directory or any ancestor directory, that will override which version of the SDK is run. (That's useful if you want to enforce a particular version for a project, for example.)

Judging by comments, some versions of VS2017 updates do install the .NET Core SDK. I suspect it may vary somewhat over time.

like image 122
Jon Skeet Avatar answered Oct 05 '22 10:10

Jon Skeet