Go into a folder, let's say C:\MyTest
Run: dotnet new globaljson
This will create a global.json
file with your current version of the dotnet CLI in it, for example:
{
"sdk": {
"version": "6.0.100-rc.2.21505.57"
}
}
So in this case, when you do dotnet new -i Umbraco. Templates::*
the VS templates will be installed for version 6-RC2 of the framework.
Visual Studio 2022 runs dotnet v6 by default but VS2019 runs dotnet 5 by default.
In order to figure out which versions we have available on our machine, you can run dotnet --list-sdks
, the example output could be:
3.1.414 [C:\Program Files\dotnet\sdk]
5.0.402 [C:\Program Files\dotnet\sdk]
6.0.100-rc.2.21505.57 [C:\Program Files\dotnet\sdk]`
So we can update the global.json
file, which overrides the framework version used in that directory and below:
{
"sdk": {
"version": "5.0.402"
}
}
Now when we run dotnet new -i Umbraco. Templates::*
, it will install the dotnet templates in dotnet framework 5, which should make them available in VS2019.