0
votes

Let's say that I'm using Core 3.0 with Blazor templates installed

My VS updated and downloaded sdk 3.1 preview X and now my dotnet cli works in 3.1 preview by default

so using dotnet new doesn't show my installed Blazor templates that I installed while using 3.0

I tried those commands to at least see name of previous templates or actually create 3.0 Blazor project, but nothing works

dotnet new --sdk-version "3.0.100-preview7-012821"

dotnet new --framework "netcoreapp3.0"

__

Invalid input switch:--sdk-version3.0.100-preview7-012821

How can I list dotnet new templates for previous sdk/framework and then actually create them?

1
The error message says that you forgot to type a space after --sdk-version. Hmm. - Hans Passant
@HansPassant Console output formats it quite differently, the part after : is in newline with space before, so I doubt it. dotnet new --sdk-version "3.0.100-preview7-012821" - Axelly

1 Answers

3
votes

Based on this: https://docs.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version

Create a global.json file in your new project folder with the following content (for .net core 2.2.203 - change to required version):

{
  "sdk": {
    "version": "2.2.203"
  }
}

From a command line cd into that folder and run: dotnet new choose-template-name

Running any dotnet CLI command in this folder and sub-folders, will use the specified SDK.

Make sure the SDK is installed first, of course.