【问题标题】:System.TypeLoadException: Could not load type 'System.Data.Entity.Infrastructure.Design.Executor+GetContextType' from assembly 'EntityFrameworkSystem.TypeLoadException:无法从程序集“EntityFramework”加载类型“System.Data.Entity.Infrastructure.Design.Executor+GetContextType”
【发布时间】:2021-07-20 07:55:43
【问题描述】:

我使用 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 throwOnError, Boolean ignoreCase)
   at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, 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, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

【问题讨论】:

    标签: entity-framework-6 xaf


    【解决方案1】:

    我通过 Nuget 升级到 EF 6.4,然后能够启用迁移

    【讨论】:

      猜你喜欢
      • 2010-11-30
      • 1970-01-01
      • 1970-01-01
      • 2015-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-28
      • 2016-11-07
      相关资源
      最近更新 更多