ASP.NET 5.0中的脚手架标识错误(没有MVC的WebApp)



我想获得Identity的源页面,并在文档中执行了所有操作。我已在dotnet aspnet-codegenerator identity -h中停止,因为它抛出错误:

Usage: aspnet-codegenerator [arguments] [options]
Arguments:
generator  Name of the generator. Check available generators below.
Options:
-p|--project             Path to .csproj file in the project.
-n|--nuget-package-dir   
-c|--configuration       Configuration for the project (Possible values: Debug/ Release)
-tfm|--target-framework  Target Framework to use. (Short folder name of the tfm. eg. net46)
-b|--build-base-path     
--no-build               
Selected Code Generator: identity
No code generator found with the name 'identity'.
No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
RunTime 00:00:01.29

我在Arch Linux中有一个.NET 5.0。Microsoft.VisualStudio.Web.CodeGeneration.Design和其他安装为5.0.0的包。项目文件:

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>USER-SECRETS-ID-CENSORED</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="SendGrid" Version="9.21.2" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwrootimg" />
</ItemGroup>

我不知道该怎么解决。

如果当前版本错误,请尝试卸载:

dotnet tool uninstall --global dotnet-aspnet-codegenerator

您必须使用以下命令安装5.0版本的dotnet代码生成器:

dotnet tool install --global dotnet-aspnet-codegenerator --version 5.0.2

并键入此命令以显示所有隐藏的文件:

dotnet aspnet-codegenerator identity

最新更新