Entity Framework Migrations Issue

坚强是说给别人听的谎言 提交于 2020-01-03 17:36:29

问题


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.

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.

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

回答1:


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.




回答2:


Disable the Add-in within VS2010 (Tools-Options-Environment-Add-In/Macros Security/Allow Add-in components to laod) Disable the ReSharper if installed within VS2010 (Tools-Options-ReSharper-Suspended)

Restart VS2010, the issue will be resolved.



来源:https://stackoverflow.com/questions/9575628/entity-framework-migrations-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!