ASP.NET Core — Switch .NET Core SDK Version

Robin Ding
2 min readJul 31, 2019

In .NET Core, sometimes, we need to install different .NET Core versions for different applications, then the problem is how we switch .NET Core version for different applications.

Prior to talking about the solution, there are some commands which are really useful to know what versions you have installed on your server

  • List all .NET Core SDKs
dotnet --list-sdks
  • List all .NET Core Runtimes
dotnet --list-runtimes
  • List all .Net Core info
dotnet --info

Two solutions how to switch .NET Core SDK version

  • Create a global.json file, then put it under the folder which you want to switch .NET Core SDK
{
"sdk": {
"version": "2.2.300"
}
}
  • If you have a .csproj file, you can change the TargetFramework element
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
....
</PropertyGroup>

--

--