Enable-Migrations installation error

前端 未结 5 1342
春和景丽
春和景丽 2020-12-06 10:06

I\'m running into a problem when enabling migrations on one of my projects. I execute Enable-Migrations command from the Nuget Console and receive an err

5条回答
  •  余生分开走
    2020-12-06 10:36

    Found the problem!
    The issue was that the startup project in my solution was a modeling project. For some reason when enabling migrations on my project, the module looks at libraries related to the startup project.

    Changed my startup project to be a test project in the solution and everything worked.

    UPDATE

    Make sure your startup project contains the app.config or web.config file you want to use to connect to database. This is the file that it will be used to generate migrations even if your DbContext is located on a different project. You can set the project containing your DbContext as the startup project.

提交回复
热议问题