When I installed ".Net Core 3 SDK (preview 6)", default version of dotnet core sdk on my system is changed to this new version. Then I needed to revert the default version to "2.x.x" in some places. So I followed the steps below.
See Installed DotNet Core SDK and Runtime Versions
In order to see all installed dotnet SDK versions (and currently used default version), run:
dotnet --version
dotnet --list-sdks
In order to see all installed dotnet Runtime versions, run:
dotnet --list-runtimes
Change Default DotNet SDK Version using global.json File
In order to change default dotnet SDK version, place a global.json file in the current folder or any parent folder with the contents below. You can create the global.json file manually, or use the dotnet cli command dotnet new globaljson
.
Now dotnet core sdk version is reverted back in the folder which global.json resides, or in it's subfolders.
Note: By default dotnet new globaljson
cli command sets the SDK version using the current effective version. You can change this behaviour by adding optional --sdk-version=2.2.300
parameter.
Top comments (2)
Perfect! Thank you!
thank sir