asp.net-mvcasp.net-core

How add ASP.NET Core identity to existing Core mvc project?


I have already started my dotnet core mvc project without identity on Mac with CLI and now I want to add this feature. The only option I have known till now is to create a new project by

dotnet new mvc --auth

Is there a better way to add identity to an existing project? I hope there is a 'dotnet new' command.


Solution

  • You need to add this NuGet package via CLI in VS Code:

    dotnet add package Microsoft.AspNetCore.Identity 
    

    And if you want the standard UI pages you can install this package which contains everything embedded:

    dotnet add package Microsoft.AspNetCore.Identity.UI