Identity asp.net core 3.0 - IdentityDbContext not found

if you have an error like "error CS0246: The type or namespace name 'IdentityDbContext' could not be found" you can install bellow package for asp.net web api 3 project

dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore --version 5.0.0-preview.3.20215.14 in dotnet cli.its work for me.

Install-Package Microsoft.AspNetCore.Identity.EntityFrameworkCore -Version 5.0.0-preview.3.20215.14 this for package manager


In ASP.NET Core 3.0, Entity Framework Core and Identity related packages have been removed from the Microsoft.AspNetCore.App metapackage. So you have to add those packages separately.

Add the following PackageReferences to your project's .csproj file as follows:

<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" />
</ItemGroup>

Now it will work!

For more details: Assemblies removed from the ASP.NET Core shared framework