The current .NET SDK does not support targeting .NET Standard 2.0 error in Visual Studio 2017 update 15.3
Visual Studio-2017.Net Standard-2.0Visual Studio-2017 Problem Overview
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.
Visual Studio-2017 Solutions
Solution 1 - Visual Studio-2017
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.
Solution 2 - Visual Studio-2017
while the above answers didn't solve my problem. I finally solved it by specifically going to this link https://www.microsoft.com/net/download/visual-studio-sdks and download the required sdk for Visual Studio. It was really confusing and i don't understand why but that solved my problem
Solution 3 - Visual Studio-2017
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.
Solution 4 - Visual Studio-2017
For me the solution was to change the version in global.json
to reflect the installed one.
Like the others said the version can be found running dotnet --info
in cmd
This:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "2.0.3"
}
}
Became:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "2.1.4"
}
}
You can also create the global.json file by running
dotnet new globaljson --sdk-version 2.1.4
at root of project
Solution 5 - Visual Studio-2017
This worked for me
installation of the Visual Studio
Use theOn the tab "Workloads" check ".Net Core cross-platform development" and click on "Modify"
Don't forget to check ".NET Core 2.0 development tools" on the left menu.
Note
I installed the Asp Net Core before, however not appeared on my Visual Studio, just after I installed using the installation of Visual Studio appeared for me.
Solution 6 - Visual Studio-2017
I had installations of both Visual Studio 2019 and 2017. I tried installing the .NET Core 2.X SDK for VS2017 separately but with no luck.
The issue is, that I have .NET Core 3.0 SDK installed as default sdk-version, which VS2017 does not like.
My solution was to switch the SDK version for the specific project.
- First, list your installed SDK's to find the desired version:
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.100\
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
.NET Core SDKs installed:
1.1.14 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.509 [C:\Program Files\dotnet\sdk]
2.2.110 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
- From your solution directory:
$ dotnet new globaljson --sdk-version 2.2.110 --force
Now, dotnet
will use the specified SDK version for this solution.
I have not found a way to do this system-wide without also messing up my 3.0 projects.
Solution 7 - Visual Studio-2017
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:
Solution 8 - Visual Studio-2017
I just had this with 15.8.3 after uninstalling some .NET Core 1.x preview SDKs, my application would not compile and showed the error.
It was fixed by installing the latest x86 version of the SDK even though I'm on Windows 10 x64.
I presume this is because VS 2017 is still a x86 program and though the programs run as x64 the compiler was looking for an appropriate x86 SDK
Solution 9 - Visual Studio-2017
Actually, to me it happened in opposite way to another answers.
I did install the latest .NET Core SDK before the issue appeared (3.0.0-preview2 in my case) having not the latest version of Visual Studio (not sure if that would make any difference).
So, the solution was just to uninstall that latest .NET Core SDK. (This is not perfect if you need it, so you might consider Visual Studio upgrade to the latest one, but at least that solved ongoing issue).
Solution 10 - Visual Studio-2017
I just went through this trouble. In my case I had a working script
SET devenvPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe
"%devenvPath%" mySolution.sln /Rebuild "DebugWithUT|AnyCpu" /Out mySolution.Build.log
Today I started getting this exact error. But now I remember installing VS2019 day before. Looks like it changed something for VS2017. I went to VS2017 Update, installed latest version/update and it fixed it back.
Solution 11 - Visual Studio-2017
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
Solution 12 - Visual Studio-2017
make sure you download the x86 SDK instead of only the x64 SDK for visual studio.
Solution 13 - Visual Studio-2017
I had the same problem as the current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1
-
Make sure .Net core SDK installed on your machine. Download .NET!
-
set PATH environment variables as below Path
Solution 14 - Visual Studio-2017
I had this issue while trying to build my solution in TFS. We were using "dot net publish" task. Using msbuild broke the ice for us.
Solution 15 - Visual Studio-2017
I had the same problem and I solved this way:
- Installed the .NET Core 2.2 SDK for Visual Studio 2017. You can download it from this link: https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral
- Went to the project -> Properties > Target Framework
And now I the 2.0 missing target framework was eligible, I selected it and the problem was solved.