简体   繁体   中英

The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower

Hi I am using VS 2017 Commuity. When I build I am getting the this error I have also installed latest sdk , even I am having same issue. Kindly help

It's very important and not necessarily obvious, but you'll want to make sure that you explicitly target the 2.2.1xx version when running Visual Studio 2017 as the build versions differ between Visual Studio 2017 and 2019 :

  • Visual Studio 2019 - 2.2.2xx
  • Visual Studio 2017 - 2.2.1xx

It's very likely that you installed the latest version, but not necessarily the one with support for Visual Studio 2017. You can find the appropriate version for 2017/2019 from the .NET Core Download page here that demonstrates the distinction between the two SDKs and which version of Visual Studio is supported for each:

Visual Studio 2017 版本

In my case, the following fixed the issue:

Find out the latest SDK installed by issue the following command in CMD:

dotnet --list-sdks

Then in your project's global.json file, update the version to the latest version found from previous command:

{
  "sdk": {
    "version": "3.1.302"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM