且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“无法加载文件或程序集“System.Core,版本=2.0.5.0,..."动态加载可移植类库时的异常

更新时间:2023-01-08 20:53:27

您可以返回您平台的 System.Core 程序集(例如 version 4.0.0.0 for .NET Framework 4.0) 来自 AssemblyResolve 事件,当被要求提供 2.0.5.0 版本时.

You can return the System.Core assembly of your platform (e.g. version 4.0.0.0 for .NET Framework 4.0) from the AssemblyResolve event, when asked for the 2.0.5.0 version.

我正在通过 Load(byte[]) 加载存储为资源的所有引用程序集,这也无法解析 2.0.5.0 程序集,并且我检索了两者SystemSystem.Core 来自 AppDomain.CurrentDomain.GetAssemblies().

I am loading all my referenced assemblies stored as resources via Load(byte[]), which also fails to resolve the 2.0.5.0 assembly, and I retrieve both System and System.Core from AppDomain.CurrentDomain.GetAssemblies().