实体框架迁移问题 [英] Entity Framework Migrations Issue

查看:262
本文介绍了实体框架迁移问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了EF迁移问题,特别是让启用迁移命令工作。当我在包管理器控制台中执行命令时,我收到以下错误:

I'm having an issue with EF Migrations, specifically with getting the "Enable-Migrations" command to work. When I execute the command in the Package Manager Console I receive the following error:

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类型或命名空间。无论如何,对此的任何帮助将不胜感激!

It seems to me that the NuGet console can't find the MigrationsCommands type from my EF assembly. I've checked and the assembly is the most recent one (4.3.1), and from within object browser I am unable to find the MigrationsCommands type or namespace. Anyway, any help on this would be greatly appreciated!

更新:我仍然没有解决方案,但它看起来像当我在包管理器控制台中运行Install-Package EntityFramework命令时,问题出在以下输出中。错误在这里:

UPDATE: I still do not have a resolution, but it looks like the source of the issue is in the following output when I run the "Install-Package EntityFramework" command within the Package Manager Console. The error is here:

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的 Here Haack对Chris的反应反映6.5。我安装了Reflector(版本7.0好奇),并在VS2010内启用了Reflector Add-On。在研究 NuGet常见问题解答后,我卸载了Reflector并禁用了VS2010加载项。这似乎已经解决了这个问题,因为我现在可以同时使用安装包实体框架和启用迁移,而不会出现问题。

After several hours of searching I have found the solution. They key is located Here in Phil Haack's response to "Chris" regarding Reflector 6.5. I had Reflector installed (version 7.0 curiously enough) and the Reflector Add-On enabled within VS2010. Upon researching the NuGet FAQ I uninstalled Reflector and disabled the VS2010 Add-In. This seems to have resolved the issue as I can now both "Install-Package EntityFramework" and "Enable-Migrations" without issue.

这篇关于实体框架迁移问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆