Selecting Dotnet Core SDK Version while Creating a new Project
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.
![](https://codinginfinite.com/wp-content/uploads/2019/05/Screenshot-2019-05-23-at-1.15.54-PM-1024x276.png)
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.
![](https://codinginfinite.com/wp-content/uploads/2019/05/Screenshot-2019-05-23-at-9.52.49-AM.png)
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.
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
![](https://codinginfinite.com/wp-content/uploads/2019/05/Screenshot-2019-05-23-at-10.19.33-AM.png)
& the all Installed SDK Versions as well
![](https://codinginfinite.com/wp-content/uploads/2019/05/Screenshot-2019-05-23-at-10.24.46-AM.png)
It also showed me the installed runtimes.
![](https://codinginfinite.com/wp-content/uploads/2019/05/Screenshot-2019-05-23-at-10.27.18-AM.png)
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.
![](https://codinginfinite.com/wp-content/uploads/2019/05/Screenshot-2019-05-23-at-10.45.58-AM.png)
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