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

Multi tool use
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 Target Framework combobox in Project/Application window. So I changed TargetFramework tag in .csproj file manually to netstandard2.0
, but after trying to build I get this error:
netstandard2.0
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.
global.json
@JonSkeet installing .NET Core 2.0 SDK separately worked. It will be good if you add your suggestion as an answer here.
– sahar
Aug 17 '17 at 10:51
5 Answers
5
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.)
global.json
Judging by comments, some versions of VS2017 updates do install the .NET Core SDK. I suspect it may vary somewhat over time.
@Marwie: To target netstandard2.0, I suspect you do. I haven't tried targeting that with the 1.0 SDK, but I wouldn't be surprised if it failed. You can still target netstandard1.X with the 1.0 SDK of course.
– Jon Skeet
Aug 17 '17 at 16:27
Ok - I'm new to the subject - I was surprised about the close relationship between .net core and .net standard - wasn't the reason to create .net standard to omit such dependencies? Why wouldn't it ship in a separate package?
– Marwie
Aug 17 '17 at 16:29
@Marwie: Well, .NET Core SDK is separate from the .NET Core Runtime, which is separate from the .NET Standard. But the SDK "knows about" a set of target frameworks, and I'm not surprised that it won't work with a future one. It's like expecting Visual Studio 2013 to compile C# 7 code. While it would possibly be feasible for MS to have engineered it so that you didn't need the .NET Core 2.0 SDK to target netstandard2.0, it would be an odd use case to want that anyway, IMO.
– Jon Skeet
Aug 17 '17 at 16:37
I received the error after i uninstalled all the .net Core 1.x SDKs. I still had Microsoft. .NET core SDK 2.0.2, 2.0.3, 2.1.1 and 2.1.2 installed and VS 2017 5.2. Once I did a manual install of the current Microsoft. .NET core SDK (2.1.3) I could again compile my projects. I wonder what in removing the 1.x SDKs broke the 2.x SDKs.
– SOHO Developer
Dec 22 '17 at 18:52
@Justin: Okay, so that sounds like either the 2.1.4 SDK hasn't installed properly, or you've got a global.json file pinning it to an old version.
– Jon Skeet
Jan 25 at 19:41
For me the solution was to change the version in global.json
to reflect the installed one.
global.json
Like the others said the version can be found running dotnet --info
in cmd
dotnet --info
This:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "2.0.3"
}
}
Became:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "2.1.4"
}
}
When I upgraded Visual Studio to version 15.5.1, .Net Core SDK was upgraded to 2.X, so this error went away. When I run dotnet --info
, I see the following now:
dotnet --info
I had same problem, and have the latest ver
Microsoft Visual Studio Community 2017
Version 15.7.3
I just downloaded the latest SDK 2.1 and no more targeting issue.
https://www.microsoft.com/net/download/thank-you/dotnet-sdk-2.1.301-windows-x64-installer
Info:
Microsoft Visual Studio Community 2017
Version 15.7.3
VisualStudio.15.Release/15.7.3+27703.2026
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Community
C# Tools 2.8.3-beta6-62923-07. Commit Hash: 7aafab561e449da50712e16c9e81742b8e7a2969
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
Visual Basic Tools 2.8.3-beta6-62923-07. Commit Hash: 7aafab561e449da50712e16c9e81742b8e7a2969
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Unity 3.7.0.1
Visual Studio Tools for Unity
This happens sometimes when I'm trying to open my old projects, what helps me is to change projects target framework.
Go to Project -> projectname Properties... and change the Target framework to the one that you have installed.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Do you have a
global.json
file pinning your .NET Core SDK to 1.x? Have you installed the .NET Core 2.0 SDK separately? (I'd expect it to be included with VS, but it wouldn't hurt to install it anyway.)– Jon Skeet
Aug 17 '17 at 10:11