I was so excited to use some of the great features coming in .Net Core SDK version 3.0. I couldn’t wait till full release so I decided to work with .Net Core 3.0 Preview.

After installing SDK 3.0 Preview when I created a new project using dotnet core CLI, the project was created with the latest installed SDK version available in my system, which was 3.0 Preview.

All went amazing, I tested some of the awesome features of the new SDK. I would like to thank Microsoft again for their efforts to make .Net Core the best available framework.

WHY I’M IN LOVE WITH .NET CORE

After a few days, I wanted to create a new project with .Net Core SDK Version 2.2, which was the latest available stable version but when I tried creating a new project, It was using 3.0 Preview Version as my Current Running Dotnet Core SDK Version.

Checking my Current & other Installed SDK Versions

I tried this command

dotnet --info

It showed me the SDK Version I’m currently running

& the all Installed SDK Versions as well

It also showed me the installed runtimes.

Switching Between the .NET Core SDK Versions

Because of my current SDK Version was 3.0 Preview, If I run dotnet new console It creates a new project for me targeting the 3.0 Preview.

In case, I want to create a new project with the stable version installed in my system, I need to create a file at the root directory of my project as global.json & specify the version we want to use from the list of installed SDK versions.

First of all, create a new Directory for your project & use cd (Change Directory command ) in your CLI to go to that directory.

Now create a new file as global.json at the root directory of your project & add the Code below.

{
  "sdk": {
    "version": "2.2.104"
  }
}

Run this command now dotnet new console It will create a new project targeting the SDK specified in your global.json file.

You can create project targeting any SDK installed in your system by just specifying in global.json file, following the above method.

I hope this article will help you, comment If you have any query or find any difficulty.

Here are more Articles you might be Interested

— Best 20 .Net Core Libraries Every Developer should know

– Creating Admin Panel in Asp.net Core MVC – Step by Step Tutorial

— The Ultimate Guide to the Best .NET Core E-commerce Open Source Platforms

– Top 10 .Net Core Features You need to know

Author

I'm passionate about learning new technologies as well as mentoring and helping others get started with their programming career. This blog is my way of giving back to the Community.

Write A Comment