A A
A A

Reputation: 33

ASP.NET error: More than one DbContext was found. Specify which one to use

I am building an ASP.NET MVC application, and when add In the Package Manager Console (PMC), enter the following commands:

Add-Migration InitialCreate
Update-Database

I got this error:

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.

This is my code:

Upvotes: 2

Views: 6231

Answers (2)

PM> Add-Migration AdditionalFields 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.

Upvotes: 0

Rena
Rena

Reputation: 36645

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.

This error means there are several classes that have been inherited from DbContext class. So add migration with:

Add-Migration InitialCreate -context MvcWatchesContext.

Upvotes: 3

Related Questions