Authentication - Context - no context was found

Dean Everhart 1,536 Reputation points
2023-04-15T15:33:47.2833333+00:00

Having really difficult getting through Migration of first Authentication tutorial... Any help appreciated.

PM> Add-Migration CreateIdentitySchema  -Context -AuthenticationTutorialContext
Build started...
Build succeeded.
No DbContext named '-AuthenticationTutorialContext' was found.
PM> Add-Migration CreateIdentitySchema  -Context -AuthenticationTutorialContext
Build started...
Build succeeded.
No DbContext named '-AuthenticationTutorialContext' was found.


GitHub: Authentication Tutorial: Introduction to Identity on ASP.NET Core / Migrations Environment: Net Core 6, Visual Studio Community 2022 (64 bit), WIndows 11  


At the scaffolding step, I selected....

Layout

Views.Shared._Layout.cshtml

Context

Areas.Identity.Data.AuthenticationTutorialContext.cs

Note: second context file at Data.ApplicationDbContext ?

User's image

User's image

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,400 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,417 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AgaveJoe 27,696 Reputation points
    2023-04-15T17:03:14.58+00:00

    Stop creating a second Identity DbContext. Rather than clicking the plus sign, select the Identity DbContext you already created. It not clear why you keep creating two DbContext classes. If you have more than one project in the solution make sure you select the correct "Default Project" in the Package Manager Console.

    1 person found this answer helpful.
    0 comments No comments