本文介绍了无法通过输入模板名称确定所需的模板:blazorserverside的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置blazor服务器端,但是在尝试安装时始终出现此问题

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

遵循本教程来自微软,我在Powershell窗口中收到此错误

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

推荐答案

简介

Dotnet Preview6 SDK带有Blazor服务器端模板.仅当您要创建托管的客户端或库时,才需要安装模板.

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.

要安装模板,您应该使用dotnet new -i作为模板名称,并可选地使用版本.

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

添加模板后,您忘记设置模板的版本,您做了:

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

代替:

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

因此,您是否有两次blazorserverside:每个版本一个.

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

好消息,很容易解决.

第1步:删除错误的模板:

dotnet new -u Microsoft.AspNetCore.Blazor.Templates

第2步:安装(可选)新的.请记住,您不需要此模板即可创建服务器端的blazor应用程序.

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

享受您的实验室.

这篇关于无法通过输入模板名称确定所需的模板:blazorserverside的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 17:03