NETSDK1141: Unable To Resolve The .NET SDK Version As Specified

Recently, I downloaded one of my existing GitHub Projects in new machine for some modifications. However, I was unable to build the solution and was getting the below error message.

Exact Error

NETSDK1141: Unable to resolve the .NET SDK version as specified in the global.json located at C:\...\src\global.json.

I was getting this error because of a missing SDK for the project. Since this is an existing project, I downloaded from GitHub to add/modify the project.

First, we need to verify the SDK required for this project. As suggested by error, we can open the global.json file and check the SDK required for this project.

As per my project, I opened the global.json SDK and found the below code:

{
	"sdk": {
		"version": "3.1.102",
		"rollForward": "latestFeature"
	}
}

As per this global.json file, I need to have .NET core SDK 3.1.102.

We can download and install from Microsoft site.

https://dotnet.microsoft.com/en-us/download/dotnet/3.1

Note: You can download the latest version of 3.1.XXX. Also, as per your OS, download SDK.

After downloading, install it like normal installation.

Finally, restart Visual Studio and open the project.

Rebuild the solution, the mentioned error/issue will be resolved.

Kind Regards