Switch dotnet SDK version with global.json

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s