核心3:找不到名称为“ identity”的代码生成器

时间:2019-12-09 15:11:03

标签: asp.net-identity asp.net-core-3.0 asp.net-mvc-scaffolding

dotnet --info

.NET Core SDK (reflecting any global.json):

Version:   3.0.100

Commit:    04339c3a26 
Runtime Environment:

OS Name:     Mac OS X

OS Version:  10.15

OS Platform: Darwin

RID:         osx.10.15-x64

Base Path:   /usr/local/share/dotnet/sdk/3.0.100/ 
Host (useful for support):

Version: 3.0.0

Commit:  7d57652f33 
.NET Core SDKs installed:

3.0.100 [/usr/local/share/dotnet/sdk] 
.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

我创建了一个新的ASP.Net Core MVC Web应用程序并添加了软件包:

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design

dotnet add package Microsoft.EntityFrameworkCore

dotnet add package Microsoft.EntityFrameworkCore.SqlServer

dotnet add package Microsoft.EntityFrameworkCore.Design

dotnet add package Microsoft.AspNetCore.Identity

我尝试运行命令:

dotnet aspnet-codegenerator identity -h

我得到:

Selected Code Generator: identity
No code generator found with the name 'identity'.

自更新SDK和运行时以来,为什么``身份''不是有效的代码生成器?

1 个答案:

答案 0 :(得分:1)

通过使用DELETE命令行,它将在.csproj文件中生成以下引用:

dotnet add package

将版本更改为3.0.0,如下所示:

<ItemGroup>
   <PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
   </PackageReference>
   <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />
   <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
</ItemGroup>