.NET Core 2.1 downloads for Linux, macOS, and Windows.NET Core is a cross-platform version of.NET, for building apps that run on Linux, macOS, and Windows. This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use.
The current version of the dotnet command line interface provides features to add a nuget package, but doesn’t expose a separate command to update them. However, you can actually achieve this by simply running the dotnet add package command, for example:
If you don’t provide a version flag, this will default to upgrading to the latest version. To specify a version, add the -v parameter:
Here you can see a sample project with an older version of AspNetCore shown in Visual Studio’s Nuget Package Manager:
Run the command in Powershell:
The result is the updated version in the project.
Currently there isn’t a command to browse, search, or list packages from the dotnet CLI. However, this is coming in version 2.0.
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.
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.
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