【发布时间】:2020-12-14 10:51:54
【问题描述】:
无法使用 aspnet-codegenerator 生成脚手架,以下是我尝试过的:
-
使用创建了一个 ASP.Net RazorPages 应用程序
dotnet new webapp -
做了
dotnet build -
使用 dotnet-aspnet-codegenerator 安装
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4 -
跑
dotnet aspnet-codegenerator --help它说:此项目中没有可用的代码生成器。将 Microsoft.VisualStudio.Web.CodeGeneration.Design 包作为 NuGet 包引用添加到项目中。
-
添加步骤 4 中提到的包使用
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design添加的包是:
<ItemGroup> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> </ItemGroup> -
又跑了:
dotnet build最后一步
-
跑
dotnet aspnet-codegenerator --help再次它说:此项目中没有可用的代码生成器。将 Microsoft.VisualStudio.Web.CodeGeneration.Design 包作为 NuGet 包引用添加到项目中。
.Net core安装版本:3.1.401
操作系统:Ubuntu 20.04
【问题讨论】:
-
最初,我可以按预期使用这些代码生成器。但是,我将.NET Core SDK更新为3.1.401版本后,现在报“此项目中没有可用的代码生成器”。
-
很多人都会遇到同样的问题。 https://github.com/dotnet/Scaffolding/issues/1393
标签: asp.net-core .net-core asp.net-core-mvc razor-pages asp.net-core-razor-pages