Enabling Code First Entity Framework VS Web Express 2012

后端 未结 6 1940
死守一世寂寞
死守一世寂寞 2021-01-01 22:38

I am trying to enable Code First in my Visual Studio Web Express 2012. From what I have read so far I have to use the Package Manager Console and the command Enable-Migratio

6条回答
  •  悲哀的现实
    2021-01-01 23:30

    I've run into this issue twice now. Both times I've had to uninstall entity framework then re-install it for each project in the solution. One thing that took me a while to figure out the second time I did this is that I had to re-start Visual Studio (2012) after re-installing Entity Framework (or I continued to get the "Could not load file or assembly '[path]\packages\EntityFramework.5 .0.0\tools\EntityFramework.PowerShell.Utility.dll'" error).

    To get to the Package Manager Console go to: Tools -> Library Package Manager -> Package Manager Console

    In the Package Manager uninstall Entity Framework for each project (I selected each project from the Default Project dropdown at the top of the Package Manager Console):
    Uninstall-Package EntityFramework -Force

    Then install it for each project:
    Install-Package EntityFramework

    At this point attempting to run the Enable-Migrations command gave the error still, until I closed and restarted Visual Studio. Then it was successful, as was the Update-Database command (after setting AutomaticMigrationsEnabled to true in the Migrations.Configuration file).

提交回复
热议问题