【发布时间】:2012-03-05 23:20:23
【问题描述】:
我遇到了 EF 迁移问题,特别是让“Enable-Migrations”命令正常工作。当我在包管理器控制台中执行命令时,我收到以下错误:
System.Management.Automation.PSargumentException:找不到类型 System.Data.Entity.Migrations.MigrationsCommands]:确保已加载包含此类型的程序集。
在 System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
找不到类型 [System.Data.Entity.Migrations.MigrationsCommands]:确保已加载包含此类型的程序集。
在我看来,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
【问题讨论】:
-
您的解决方案中有多少个项目?
-
由于这是一个虚拟测试项目,我有两个项目,这两个项目都引用 EF(控制台测试工具,以及具有 dbcontext 和域的项目)。我尝试将包管理器控制台指向这两个项目。
-
拉迪斯拉夫,感谢您的评论。我已经在下面发布了答案。
标签: entity-framework entity-framework-4.3