Work on a lower version of dotnet core
Using a lower version of dotnet core in a PC has many dotnet core versions installed
At the time of writing this tutorial latest available .NET Core version is 6, while Visual Studio 2022 community is the latest available version of the Visual Studio family. But I wanted to modify and test an older application build using ASP.NET Core 2.2 and Visual Studio 2017.
globaljson
is help on working on older dotnet core
My working directory is D:\dev\dotcli. We need to switch to the older version. To do that we need to add the global.json file to the working root folder by using the command globaljson
.
PS D:\dev\dotcli> dotnet new globaljson --sdk-version 2.2.108 --force
The globaljson
command creates a global.json
file
Check the current version again
PS D:\dev\dotcli> dotnet --version
It shows 2.2.108
Check the available commands in this version.
PS D:\dev\dotcli> dotnet new --help
Here in this example, I used a new folder. But if we need to work on an older project we just need to add this file to the root folder.
It is a simple solution.
Reference: global.json overview
Comments
Post a Comment