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