我遇到EF迁移问题,特别是使“Enable-Migrations”命令正常工作。当我在包管理器控制台执行命令我收到以下错误:实体框架迁移问题
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找不到MigrationsCommands从我的EF组装式。我已经检查过,程序集是最近的一个(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
您的解决方案中有多少个项目? – 2012-03-06 09:33:05
由于这是一个虚拟测试项目,我有两个项目,它们都引用EF(控制台测试工具和带有dbcontext和域的项目)。我已经尝试将包管理器控制台指向两个项目。 – jdscolam 2012-03-06 15:09:43
拉迪斯拉夫,感谢您的评论。我已经发布了下面的答案。 – jdscolam 2012-03-07 20:22:35