【问题标题】:Core 3 : No code generator found with the name 'identity'核心 3:找不到名称为“身份”的代码生成器
【发布时间】:2019-12-12 10:48:01
【问题描述】:

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 和运行时后,'identity' 不是一个有效的代码生成器?

【问题讨论】:

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


    【解决方案1】:

    通过使用dotnet add package 命令行,它会在.csproj 文件中生成以下引用:

    <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>
    

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

    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
    

    【讨论】:

    • 非常感谢。我没有注意到安装的版本。所以你会认为添加包过程会验证匹配的版本......哎呀
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-01
    • 1970-01-01
    • 2020-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多