Reputation: 1779
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.
Upvotes: 137
Views: 179996
Reputation: 10600
I fought this problem for days, and what I concluded was that one of my SDK versions was broken.
For example I had 6.0.308 and 6.0.309 installed (in addition to 2.1). What ultimately seemed to fix it was to uninstall (via Add/Remove Programs) 6.0.309, then uninstall 6.0.308 (I had to reinstall it and then remove it -- which I couldn't do with 6.0.309 still installed), then I installed 6.0.310. Not sure exactly which of those worked, but uninstalling/reinstalling the 2.1 versions did not help, only those 6.0 versions.
Upvotes: 0
Reputation: 61
I had the same problem and I solved this way:
And now I the 2.0 missing target framework was eligible, I selected it and the problem was solved.
Upvotes: 2
Reputation: 87
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.
Upvotes: 0
Reputation: 1
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
1) Make sure .Net core SDK installed on your machine. Download .NET!
2) set PATH environment variables as below Path
Upvotes: 0
Reputation: 71
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.
$ 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]
$ 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.
Upvotes: 7
Reputation: 18567
make sure you download the x86 SDK instead of only the x64 SDK for visual studio.
Upvotes: 1
Reputation: 19330
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.
Upvotes: 1
Reputation: 754
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
Upvotes: 12
Reputation: 1129
This worked for me
On 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.
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.
Upvotes: 12
Reputation: 4779
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).
Upvotes: 2
Reputation: 8156
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
Upvotes: 3
Reputation: 598
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
Upvotes: 28
Reputation: 818
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.
Upvotes: 15
Reputation: 1
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
Upvotes: 0
Reputation: 1499840
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.
Upvotes: 164
Reputation: 57482
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:
Upvotes: 3