如何解决System.TypeLoadException:无法从程序集“EntityFramework”加载类型“System.Data.Entity.Infrastructure.Design.Executor+GetContextType”
我使用 EF 6.2 创建了一个新的 Framework Winforms XAF 21.1.4 Winforms 项目
当我尝试通过包管理器控制台启用迁移时,我得到了
System.TypeLoadException: Could not load type 'System.Data.Entity.Infrastructure.Design.Executor+GetContextType' from assembly 'EntityFramework,Version=6.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089'.
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly,String name,Boolean throwOnError,Boolean ignoreCase,ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name,Boolean ignoreCase)
at System.Activator.CreateInstance(String assemblyString,String typeName,BindingFlags bindingAttr,Binder binder,Object[] args,CultureInfo culture,Object[] activationAttributes,Evidence securityInfo,StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName,Object[] activationAttributes)
at System.AppDomain.CreateInstance(String assemblyName,Object[] activationAttributes)
at System.Data.Entity.Tools.AppDomainExecutor.Execute(String operation,Object resultHandler,IDictionary args)
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3](CallSite site,T0 arg0,T1 arg1,T2 arg2,T3 arg3)
at System.Data.Entity.Tools.ExecutorBase.InvokeImpl(String operation,IDictionary args)
at System.Data.Entity.Tools.ExecutorBase.GetContextType(String contextTypeName,String contextAssemblyName)
at System.Data.Entity.Tools.Commands.MigrationsEnableCommand.Execute()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at System.Data.Entity.Tools.Program.Main(String[] args)
Could not load type 'System.Data.Entity.Infrastructure.Design.Executor+GetContextType' from assembly 'EntityFramework,PublicKeyToken=b77a5c561934e089'.
解决方法
我通过 Nuget 升级到 EF 6.4,然后能够启用迁移
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。