System.TypeLoadException:无法从程序集“EntityFramework”加载类型“System.Data.Entity.Infrastruct.Design.Executor+GetContextType”

问题描述 投票:0回答:2

当我尝试通过包管理器控制台启用迁移时,我得到了

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
2个回答
1
投票


0
投票
EntityFramework

的版本安装并再次重新安装最新版本。 它是这样工作的。

这就是实际发生的变化:(我的项目目标.net 4.8.1)

packages.config

文件中 -> 版本从 461 更改为 481

  <package id="EntityFramework" version="6.4.4" targetFramework="net481" />

	
© www.soinside.com 2019 - 2024. All rights reserved.