Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework 实体框架迁移问题_Entity Framework_Entity Framework 4.3 - Fatal编程技术网

Entity framework 实体框架迁移问题

Entity framework 实体框架迁移问题,entity-framework,entity-framework-4.3,Entity Framework,Entity Framework 4.3,我在EF迁移方面遇到了一个问题,特别是在使“enablemigrations”命令正常工作方面。在Package Manager控制台中执行该命令时,我收到以下错误: System.Management.Automation.PSArgumentException:找不到类型System.Data.Entity.Migrations.MigrationsCommands]:确保已加载包含此类型的程序集。 在System.Management.Automation.MshCommandRuntim

我在EF迁移方面遇到了一个问题,特别是在使“enablemigrations”命令正常工作方面。在Package Manager控制台中执行该命令时,我收到以下错误:

System.Management.Automation.PSArgumentException:找不到类型System.Data.Entity.Migrations.MigrationsCommands]:确保已加载包含此类型的程序集。
在System.Management.Automation.MshCommandRuntime.ThrowterminingError(错误记录错误记录)
找不到类型[System.Data.Entity.Migrations.MigrationsCommands]:请确保已加载包含此类型的程序集

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

更新:我仍然没有解决方案,但当我在Package Manager控制台中运行“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
找不到类型[ConnectionFactoryConfiguratorInvoker]:请确保已加载包含此类型的程序集。
位于C:\…\packages\EntityFramework.4.3.1\tools\install.ps1:36 char:39

+[ConnectionFactoryConfiguratorInvoker]经过几个小时的搜索,我找到了解决方案。关键在于Phil Haack对“Chris”关于反射器6.5的回应。我安装了Reflector(非常奇怪的是7.0版),并且在VS2010中启用了Reflector插件。在研究后,我卸载了Reflector并禁用了VS2010加载项。这似乎解决了这个问题,因为我现在可以“安装包EntityFramework”和“启用迁移”而没有问题。

在VS2010中禁用外接程序 (工具选项环境加载项/宏安全性/允许将加载项组件添加到laod) 如果在VS2010中安装了ReSharper,请禁用它 (工具选项重锐器已挂起)


重新启动VS2010,问题将得到解决

您的解决方案中有多少个项目?因为这是一个虚拟测试项目,所以我有两个项目,它们都引用EF(控制台测试工具,以及带有dbcontext和域的项目)。我已经尝试将PackageManager控制台指向这两个项目。Ladislav,感谢您的评论。我已经在下面发布了答案。Zork,我已经启用了Resharper,没有问题。这个问题看起来与反射器有关,而不是与重拾器有关。