0

输出dotnet --info

.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  3.1.404 [/usr/share/dotnet/sdk]
  5.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

重现步骤:

  1. 安装代码生成器:dotnet tool install -g dotnet-aspnet-codegenerator
  2. 创建要脚手架的项目dotnet new webapp --auth Individual -o WebApp1
  3. cd 进入新的项目目录
  4. 安装 Microsoft.VisualStudio.Web.CodeGeneration.Design
  5. 构建项目以确保一切正常(构建正常)
  6. 运行脚手架: dotnet aspnet-codegenerator identity -dc WebApp1.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.Logout;Account.RegisterConfirmation"

预期行为:

所有 Identity.UI Razor 页面都被搭建到项目中

实际行为:

指示未找到文件的致命错误:

Account.RegisterConfirmation"
Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
A file matching the name Account.Register.cs.cshtml was not found within any of the folders: 
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:09.87

有关正在搭建的项目的其他信息,例如:

  • 目标框架:net5.0
  • Microsoft.AspNetCore.App 或 Microsoft.AspNetCore.All 的包版本(如果适用):5.0.1
  • Microsoft.VisualStudio.Web.CodeGeneration.Design 的包版本 - 这可以通过脚手架添加到您的项目中:5.0.1
4

1 回答 1

0

我遇到了 Omnisharp 无法生成我的剃须刀页面的问题。@vladimir 提供的链接,我发现为 6.0.2 运行此命令对我有用。

dotnet tool update dotnet-aspnet-codegenerator -g --version 6.0.2

你可以看到你有什么版本,dotnet --info但我只是为 6.0.2 做的,一切都重新上线了。

于 2022-02-18T01:58:49.420 回答