Search code examples
asp.net-coreasp.net-identityasp.net-mvc-scaffolding

Problem with Identity scaffolding in ASP.NET Core MVC


I made a MVC project, that includes 2 projects.

  1. class library (.NET Core) - i have my models and services/options here
  2. ASP.NET Core Web Application - Controllers, views here

I want to add identity to my project. So i found the following NuGet Packages

  1. Microsoft.AspNetCore.Identity.EntityFrameworkCore
  2. Microsoft.AspNetCore.Identity.UI
  3. Microsoft.Extensions.Identity.Stores

I used public class NameDbContext : IdentityDbContext<IdentityUser> in my DbContext class.

I clicked Add on the Web-project -> choose "New Scaffolded Item" -> pictures below

What i want to choose

The Error i get

Any ideas?

EDIT:

i can see in my database that the tables are created, after the NuGet Packages and the add-migration & update-database commands that followed.

I also tried my DbContext class without the <IdentityUser> like this

public class NameDbContext : IdentityDbContext


Solution

  • You can try to updated all NuGet packages from Tools->Nuget Package Manager -> Manage NuGet Packages for Solution -> Updates tab -> Update All.