Creating a .NET Core Solution for an older version of .NET Core
For much of my code I use the .NET Core LTS versions. Although the latest version at the time of writing is an LTS (v6) I can’t use it fully as I still have VS 2019 installed. As a result I target the previous LTS i.e. v3.1.
The simplest way for me to set this up is to declare the framework as a parameter. So if I am creating an MVC application for example I would use
dotnet new mvc --framework netcoreapp3.1
The framework option is a parameter of the mvc template and it takes the target framework moniker (TFM) as shown above.