entity-framework – 实体框架迁移问题

我遇到了EF迁移的问题,特别是在启用“启用迁移”命令时.当我在程序包管理器控制台中执行该命令时,收到以下错误:

System.Management.Automation.PSArgumentException: Cannot find type System.Data.Entity.Migrations.MigrationsCommands]: make sure the assembly containing this type is loaded.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
Cannot find type [System.Data.Entity.Migrations.MigrationsCommands]: make sure the assembly containing this type is loaded.

在我看来,NuGet控制台无法从我的EF程序集中找到MigrationsCommands类型.我已经检查过,程序集是最新的(4.3.1),从对象浏览器中我无法找到MigrationsCommands类型或命名空间.

更新:我仍然没有解决方案,但是当我在软件包管理器控制台中运行“Install-Package EntityFramework”命令时,看起来问题的根源在以下输出中.错误在这里:

Unable to find type [ConnectionFactoryConfiguratorInvoker]: make sure that the assembly containing this type is loaded.
At C:\...\packages\EntityFramework.4.3.1\tools\install.ps1:36 char:39
+ [ConnectionFactoryConfiguratorInvoker] <<<< ::Invoke((Join-Path $toolsPath "EntityFramework.PowerShell.dll"), $project)
+ CategoryInfo          : InvalidOperation: (ConnectionFactoryConfiguratorInvoker:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound

最佳答案 经过几个小时的搜索,我找到了解决方案.他们的关键位于Phil Haack对反射器6.5的“Chris”的回应
Here.我安装了Reflector(足够奇怪的7.0版本),并在VS2010中启用了Reflector Add-On.在研究了
NuGet FAQ我卸载的Reflector并禁用了VS2010插件.这似乎解决了这个问题,因为我现在可以“安装 – 包实体框架”和“启用 – 迁移”而不会出现问题.

点赞