2

Just installed .net core sdk 2.1.302 and tried to test it on VS 2017. However, the "Hello World" app didn't run. I noticed there is a yellow triangle on the Nuget package: Microsoft.AspNetCore.App. Also there is no .Net Core 2.1 at the Target framework dropdown. I did get the following error when trying to restore the package using the dotnet restore command:

C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\
Microsoft.NET.TargetFrameworkInference.targets(135,5): error : The current 
.NET SDK does not support targeting .NET Core 2.1.  Either target .NET Core
2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. 

I also got the following info with the dotnet --info command:

.NET Command Line Tools (2.0.0)
Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9
Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\
Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0
.NET Core SDKs installed:
  1.0.4 [C:\Program Files\dotnet\sdk]
  1.1.0-preview1-005077 [C:\Program Files\dotnet\sdk]
  1.1.0 [C:\Program Files\dotnet\sdk]
  2.0.0-preview2-006497 [C:\Program Files\dotnet\sdk]
  2.0.0 [C:\Program Files\dotnet\sdk]
  2.0.3 [C:\Program Files\dotnet\sdk]
  2.1.302 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Why Visual Studio can't find .net core SDK 2.1?

Any help and suggestion will be greatly appreciated.

jjkk
  • 111
  • 4
  • The error message is right there "The current .NET SDK does not support targeting .NET Core 2.1.", did you try googling that? – Brian Ogden Aug 02 '18 at 20:07
  • Possible duplicate of [The current .NET SDK does not support targeting .NET Core 2.1. target .NET Core 2.0 or lower or use a vs of the .NET SDK that support NET Core 2.1](https://stackoverflow.com/questions/49171623/the-current-net-sdk-does-not-support-targeting-net-core-2-1-target-net-core) – Brian Ogden Aug 02 '18 at 20:07
  • I read all these commands before posting my questions. None of them seem working for my case. I tried various suggestions such as reinstall .net core sdk 2.1.302 and uninstall previous versions. But, I still can't make it working. – jjkk Aug 02 '18 at 20:21
  • You definitely are stuck in a situation where you are a novice and you have an unfortunate situation where some libraries are out of date, try a brand new project if you haven't already, reinstall Visual Studio 2017 might be the best path for you – Brian Ogden Aug 02 '18 at 20:39
  • It's strange that your `Base Path` is `2.0.0` instead of `2.1.302`. Are the sdk folders exist under `C:\Program Files\dotnet\sdk`? When you run `dotnet new`, will it create `2.0` or `2.1` project from command? I suggest you try [global.json](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json) to configure `2.1.302` for checking whether `2.1.302` is installed correctly. – Edward Aug 03 '18 at 02:13
  • Please check `global.json` and change SDK version to `2.1.302`. – Lex Li Aug 03 '18 at 03:54

0 Answers0