ASP.NET Core EF Add-Migration command not working

If you need only update a identity schema existent, try it:

update-database -Context ApplicationDbContext

ApplicationDbContext = your identity context


that because you have two DbContext in your solution. First is default created when you creating project(ApplicationDbContext) and second your EF DbContext. Solution is described in error message just specify your EF DbContext


The error clearly explains to mention --context with db Context name if more than one DbContext. So try by mentioning your DbContext name.

dotnet ef migrations add Initial --context SampleDbContext

Hope this helps.


Running the following command (obtained from this article) and a response from @Maverik (from StackOverflow here) and a suggestion from @doctor above helped me resolved the issue. Thank you all for your help:

PM> Add-Migration MyFirstMigration -Context BloggingContext