Sometimes we want to work with another dotnet SDK version rather than the most recent one we have installed on our machine. We can do this by using the global.json file.
In order to switch to another SDK Version, place a file called global.json in the directory or parent directory where your project is located, with the following content:
{
“sdk”: {
“version”: “2.1.200”
}
}
In my case, I want to work with SDK Version 2.1.200, you have to put in there your version number. How to find out version numbers of the dotnet SDK’s on your machine? Use the following command in the terminal:
dotnet --list-sdks
In my case, I got the following result:
2.1.200 [C:\Program Files\dotnet\sdk]
2.1.300-rc1-008673 [C:\Program Files\dotnet\sdk]
Those are the two dotnet SDK’s versions I got on my machine.
*Featured Photo by Kyle Glenn on Unsplash