Target Dotnet core SDK Version per project

I recently have been trying to learn Asp.net core web APIs and some of the tutorials iv found have example code to follow along with. I load this up and get all kinds of errors because its months later and not the same dotnet core version.

So to remedy this issue open a cmd/terminal navigate into the project and run:

dotnet new globaljson --sdk-version 2.0.2

Make sure you change 2.0.2 to target your sdk version your project needs. This will also help you out if you are testing new dotnet core SDKs.

It's always daunting to install preview bits on your developer machine as you don't know what might break, but with .NET Core, SDKs and run-times are installed side by side, and so long as you know about global.json it's very easy to control which version of the SDK you're using. And the version of the run-time can also be controlled using the TargetFramework (and, if necessary the RuntimeFrameworkVersion) properties in your .csproj file.