Unable to determine the desired template from the input template name: blazorserverside

那年仲夏 提交于 2019-12-22 06:22:14

问题


I am trying to setup blazor server side but I keep getting this problem when trying to install it

following this tutorial from microsoft and I get this error in powershell window

PS D:\blazorTesting> dotnet new blazorserverside -o WebApplicationServerSide
Usage: new [options]

Options:
  -h, --help          Displays help for this command.
  -l, --list          Lists templates containing the specified name. If no name is specified, lists all templates.
  -n, --name          The name for the output being created. If no name is specified, the name of the current directory is used.
  -o, --output        Location to place the generated output.
  -i, --install       Installs a source or a template pack.
  -u, --uninstall     Uninstalls a source or a template pack.
  --nuget-source      Specifies a NuGet source to use during install.
  --type              Filters templates based on available types. Predefined values are "project", "item" or "other".
  --dry-run           Displays a summary of what would happen if the given command line were run if it would result in a template creation.
  --force             Forces content to be generated even if it would change existing files.
  -lang, --language   Filters templates based on language and specifies the language of the template to create.


Unable to determine the desired template from the input template name: blazorserverside.
The following templates partially match the input. Be more specific with the template name and/or language.

Templates                                 Short Name            Language      Tags
---------------------------------------------------------------------------------------------------
Blazor (server-side)                      blazorserverside      [C#]          Web/Blazor
Blazor (Server-side in ASP.NET Core)      blazorserverside      [C#]          Web/Blazor/ServerSide

Examples:
    dotnet new blazorserverside
    dotnet new blazorserverside --auth Individual
    dotnet new --help

回答1:


Introduction

Dotnet preview6 sdk comes with Blazor server side templates. You need to install templates only if you want to create hosted, client side or libraries.

To install templates you should to use dotnet new -i with the name of template and, optionally, the version.

Issue

When you added the templates you forgot to set the version of templates, you did:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates  # Bad. Don't copy-paste

Instead of:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview6.19307.2

For this reason, do you have the blazorserverside for twice: one for each version.

Solution

Good news, it is easy to fix.

Step 1: remove wrong templates:

dotnet new -u Microsoft.AspNetCore.Blazor.Templates

Step 2: install [optionally] new ones. Remember you don't need this templates to create just a server side blazor app.

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview6.19307.2

Enjoy with your labs.



来源:https://stackoverflow.com/questions/56881473/unable-to-determine-the-desired-template-from-the-input-template-name-blazorser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!