Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The current .NET SDK does not support targeting .NET Core 3.1

Tags:

.net-core

I have downloaded and install Visual Studio 2019 and have dotnet core 3.1 installed. As I am starting to play around with VS, I have just created a simple project using VS built-in Web App Template and try to run without debugging.

It gives the error of "The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 3.0 or lower, or use a version of the .NET SDK that supports .NET Core 3.1."

May I know how it can be resolved?

Thanks.

Regards, Andrew

like image 278
Andrew Avatar asked Feb 22 '20 03:02

Andrew


People also ask

Is .NET Core 3.1 supported?

NET Core 3.1 was originally released on December 3, 2019 and is supported for three years. But the actual end of support day will be the closest Patch Tuesday starting that date, which is December 13, 2022.

What is my current .NET SDK version?

You can see both the SDK versions and runtime versions with the command dotnet --info . You'll also get other environmental related information, such as the operating system version and runtime identifier (RID).

Is .NET Core 3.1 cross platform?

NET Core is cross-platform. It runs on Windows, OS X and multiple distributions of Linux. It also supports different CPU architectures.


1 Answers

If you already have the correct .NET Core 3.1 SDK installed it could be caused by a file called global.json. This file allows to configure which SDK is used:

The global.json file allows you to define which .NET Core SDK version is used when you run .NET Core CLI commands. Selecting the .NET Core SDK is independent from specifying the runtime your project targets. The .NET Core SDK version indicates which versions of the .NET Core CLI is used.

Delete the file or change the defined SDK to 3.1:

{
  "sdk": {
    "version": "3.1.100",
    "rollForward": "latestPatch",
    "allowPrerelease": false
  }
}
like image 107
magicandre1981 Avatar answered Sep 27 '22 22:09

magicandre1981