entity-framework - Entity Framework 迁移问题

标签 entity-framework entity-framework-4.3

我遇到了 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

最佳答案

经过几个小时的搜索,我找到了解决方案。他们的 key 位于Here在 Phil Haack 就 Reflector 6.5 对“Chris”的回应中。我安装了 Reflector(奇怪的是 7.0 版)并在 VS2010 中启用了 Reflector Add-On。经研究 NuGet FAQ我卸载了 Reflector 并禁用了 VS2010 插件。这似乎解决了这个问题,因为我现在可以毫无问题地“安装包 Entity Framework ”和“启用迁移”。

关于entity-framework - Entity Framework 迁移问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9575628/

相关文章:

entity-framework - Entity Framework 4.3 CF多对多关系保存对象?

c# - Entity Framework 初始化很慢——我该怎么做才能更快地引导它?

c# - 如何在 Entity Framework 4.3 中禁用模型兼容性检查?

c# - 网络核心 DbContextPool 与 AddDbContextPool 等

c# - 删除具有一对一可选关系的实体时出现 EntityFramework 错误

c# - EF Code First 通用检查是否存在没有公共(public) ID 属性的对象?

entity-framework - 如何使用代码优先迁移创建数据库?

c# - Linq 查询,弄乱了方法中的 where 子句

c# - 未实现 WCF 接口(interface)

visual-studio-2010 - 程序集绑定(bind)旧引用异常