asp.net-identityasp.net-core-3.0asp.net-mvc-scaffolding

Core 3 : No code generator found with the name 'identity'


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]

I created a new ASP.Net Core MVC web app and added packages:

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

I try to run the command:

dotnet aspnet-codegenerator identity -h

and I get:

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

​Why isn't 'identity' a valid code generator since updating the SDK and runtime?


Solution

  • By using dotnet add package command line,it would generate the following reference in .csproj file:

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

    Change the Version to 3.0.0 like below:

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