我在使用EF迁移时遇到了问题,具体是无法让“Enable-Migrations”命令正常工作。当我在程序包管理器控制台中执行该命令时,会收到以下错误提示:
在我看来,NuGet控制台无法从我的EF程序集中找到MigrationsCommands类型。我已经检查过,该程序集是最新的(4.3.1),但是在对象浏览器中,我无法找到MigrationsCommands类型或命名空间。 更新: 我仍未解决此问题,但看起来问题的根源在于我在包管理器控制台中运行“Install-Package EntityFramework”命令时出现的以下输出。错误在这里:System.Management.Automation.PSArgumentException: 找不到类型System.Data.Entity.Migrations.MigrationsCommands: 请确保包含此类型的程序集已加载。
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
找不到类型[System.Data.Entity.Migrations.MigrationsCommands]: 请确保包含此类型的程序集已加载。
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