Base solution for your next web application
Open Closed

getting error in update-database 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. #12171


User avatar
0
vvijaydeveloper created

Hi, I just purchased aspnetzero license and downloaded the code and tried to run the application but getting error at update-database command

"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."

Note : I did not modify and config settings.


1 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi vvijaydeveloper

    To perform the database migration, you can set the *.Migrator project as the Startup Project and run it to create the database. The *.Migrator project is also used for other purposes. You can check the details here.

    Alternatively, after opening the Package Manager Console, select the *.EntityFrameworkCore project from the Default Project dropdown menu at the top. Then, set the *.Web.Mvc or *.Web.Host project as the Startup Project through the Solution Explorer. You can update the database by entering the following command in the console:

    Update-Database
    

    or

    Update-Database -Context {{YourProjectName}}DbContext