visual studio 2017 .NET SDK does not support targeting .NET Core 2.0

时间:2017-12-18 05:27:29

标签: visual-studio-2017 .net-core-2.0

I am breaking my head over this for a while now:

I have tried installing both professional and community version of visual studio 2017 v 15.5.2

and installed .net core Runtime 2.0.3 and .net core SDK 2.1.2.

When I open a new web application I get an error saying

"the sdk 'microsoft.net.sdk.web' specified could not be found"

When I try to build an existing project I get an error

"the current .NET SDK does not support targeting .NET Core 2.0. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.0."

I don't see ".net core 2.0" in my target framework

I don't have global.json file in my computer

When I try dotnet --info, I get this

.NET Command Line Tools (2.1.2)

Product Information:

Version: 2.1.2

Commit SHA-1 hash: 5695315371

Runtime Environment:

OS Name: Windows

OS Version: 10.0.10586

OS Platform: Windows

RID: win10-x64

Base Path: C:\Program Files\dotnet\sdk\2.1.2\

Microsoft .NET Core Shared Framework Host

Version : 2.0.3

Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

Some one please help

1 个答案:

答案 0 :(得分:3)

通过添加MSBuildSdksPath userVariable来修复它。

添加名为C:\Program Files\dotnet\sdk\2.2.102\Sdks 的环境变量。

它的值应指向Dotnet SDK文件夹。例如:

{{1}}