Add-Migration CreateIdentitySchema

Dean Everhart 1,496 Reputation points
2023-02-02T19:03:35.49+00:00

Having difficulty with the Add-Migration CreateIdentitySchema step in the tutorial. Any help would be appreciated:

Tutorial: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-6.0&tabs=visual-studio#scaffold-identity-into-a-razor-project-with-authorization

Directions

PowerShellCopy

Install-Package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
Add-Migration CreateIdentitySchema
Update-Database

First attempt

PM> add-migration CreateIdentitySchema

Build started...

Build succeeded.

More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.

There are two Context files:

projectname.data.ApplicationDbContext

projectname.areas.identity.data.WebApplication1Context

My assumption is that it is the second context file - in the areas.identity.data folder - that I'm targeting since the tutorial is authorization.

Second Attempt

PM> add-migration CreateIdentitySchema -Context Areas\Identity\Data\

Build started...

Build succeeded.

No DbContext named 'Areas\Identity\Data' was found.

PM> add-migration CreateIdentitySchema -Context Areas\Identity\Data\WebApplication1Context.cs

Build started...

Build succeeded.

No DbContext named 'Areas\Identity\Data\WebApplication1Context.cs' was found.

PM> add-migration CreateIdentitySchema -Context WebApplication1Context.cs

Build started...

Build succeeded.

No DbContext named 'WebApplication1Context.cs' was found.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,148 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,248 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful