If you’re working with different versions of .NET Core, you’ll need different SDKs. But this isn’t as easy as it looks.
In this article, we’ll learn how we can switch between the versions of the .NET Core SDK as per our needs.
If you have worked on one project that used .NET Core version 2.1 and then you installed .NET Core 3.0 Preview, you will get an SDK error while trying to run your .NET Core 2.1 project. This is because your current SDK version has changed to 3.0
A big advantage of .NET Core is that it installs .NET Core SDKs separately, so the new SDK does not affect the previously installed SDK. You can see all the installed SDKs under “C:\Program Files\dotnet\sdk”.
First, we are going to see how we can view our current SDK version on the machine. By default, it will be the latest installed version (the SDK you installed at last).
To view your current SDK version, follow the below steps.
Open the command prompt and type the below command.
dotnet --version
To view all installed SDKs, follow the below steps.
Open the command prompt and execute the following command: dotnet --info
. This will show the list of all available SDKs on your system.
Open your project’s source folder and, in the address bar, type “cmd” and press Enter. It will open the command prompt with the project path.
Execute the following command: dotnet --version
It will display your project’s current SDK version,i.e., 2.1.503 in our case.
Now, we are going to change this version to Core 3.0. For that, type the below command and press Enter.
dotnet new globaljson --sdk-version 3.0.100-preview-010184 --force
It will create a “global.json” file which is stored in the folder of the current version of your project’s SDK.
{ "sdk": { "version": "3.0.100-preview-010184" } }
To create the “global.json” file in the current directory folder, you need to fire this command:
dotnet new globaljson
This will create a “global.json” file and, by default, it is set to the latest version.
Here, we have changed the current SDK version of our project and learned how we can view, upgrade, or downgrade the SDK. It’s very easy to control the SDK version in .NET Core. Feel free to leave feedback/comment/questions related to this article in the comments section.
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
View Comments
I think this is a real great blog. Much obliged.
Hey! Someone in my Facebook group shared this website with us so I came to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Wonderful blog and excellent style and design.
Good post. I be taught one thing more difficult on completely different blogs everyday. It will always be stimulating to learn content material from other writers and follow somewhat one thing from their store. I抎 want to use some with the content material on my blog whether or not you don抰 mind. Natually I抣l give you a hyperlink on your net blog. Thanks for sharing.
Not getting you
You actually make it seem so easy with your presentation but I find this topic to be actually something that I think I would never understand. It seems too complex and very broad for me. I am looking forward for your next post, I抣l try to get the hang of it!
Thanks for the feedback!