Reputation: 46750
I am using Package Manager Console to add migrations to my database and for some reason it just freezes and does nothing. The only way to stop it and continue using it is to close down Visual Studio using the Task Manager. Is this a known issue?
Upvotes: 13
Views: 3286
Reputation: 8969
Based on Sean Keating's answer, if it solved your "Enable-Migrations" problem, you must know that it might not be enough.
Add-Migration
To create a new migration script, you do it like you would do it normally:
Add-Migration MyModifications
Update-Database
To update the database though, you will have to specify your context's project:
Update-Database -ProjectName MyProject.Framework
Where I specified:
-ProjectName
as the project that held my Context fileUpvotes: 0
Reputation: 1728
I'm not sure if this is a known issue, but I had the same problem, and found a solution for it.
I had to run:
Enable-Migrations -ContextTypeName MyContext -ProjectName MyProject.Framework -StartUpProjectName MyProject.Web
Where I specified:
-ContextTypeName
as the name of my context-ProjectName
as the project that held my Context file-StartUpProjectName
as the project that held the web application.You can reference this resource for more information: http://coding.abel.nu/2012/03/ef-migrations-command-reference/
Upvotes: 6