EF Migrations error: could not load type 'System.Data.Entity.Infrastructure.DbContextInfo'

允我心安 提交于 2019-12-05 22:23:57

Try installing the msi.

http://www.microsoft.com/download/en/details.aspx?id=26825

The second error that you are getting sounds like it s having problems identifying a context within your project. Make sure that you have a class that inherits from DbContext.

I would also check that your project is referencing the correct version of the Entity Framework - 4.1 Update 1. Depending on the project type, you should be able to locate the reference in question within the References folder within your project. You may need to click on the 'Show All Files' button (second from the left in the toolbar at the top of the Solution Explorer).

Once you have the reference selected, you will see information such as the path of the DLL and its version in the Properties pane (F4 if it is not already visible).

Edit: According to JTew below, a restart of Visual Studio is required.

Had the same error.

I had:

  • Installed EF 4.1 (the older version) via an .msi
  • Installed the newer version (EF 4.1 Update 1 Migrations Alpha 3) via NuGet

This error turned out to be the framework complaining because it was getting the older 4.1.0.0 from the GAC.

Uninstalling the older EF 4.1 did the trick.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!