Authentication - Context - no context was found

Dean Everhart 1,541 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

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | ASP.NET | Other
{count} votes

1 answer

Sort by: Most helpful
  1. AgaveJoe 30,406 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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.