如何解决CefSharp Core Runtime dll 格式不正确
我得到 System.IO.FileNotFoundException: 'Could not load file or assembly 'CefSharp.Core.Runtime,Version=89.0.170.0,Culture=neutral,PublicKeyToken=40c4b6fc221f4138'. The system cannot find the file specified.'
文件和其他 dll 一起在 bin 目录中。
项目设置:
面向 netcore 3.1 的控制台应用程序使用面向 netcore 2.0 的类库,该类库加载使用具有 CefSharp.Offscreen 89.0.170 的 netcore 应用程序 3.1 构建的驱动程序
单步调试调试器时,我发现无法加载 CefSharp.Core 所依赖的 CefSharp.Core.Runtime.dll。尝试加载带有 incorrect format. (0x8007000B)
的程序。
dll 取自 cef nuget 包的 x64 文件夹,并在 csproj 中反映出来。
C:\Users\{user}\.nuget\packages\cefsharp.common.netcore\89.0.170\runtimes\win-x64\lib\netcoreapp3.1
我不知道是什么导致了这种情况,有没有人对在哪里查看以及可能是什么原因有任何建议?
EDIT 1 -- 代码说明
private static System.Reflection.Assembly Resolver(object sender,ResolveEventArgs args)
{
if (!args.Name.StartsWith("CefSharp.Core.Runtime")) return null;
string assemblyName = args.Name.Split(new[] {','},2)[0] + ".dll";
string archSpecificPath = $"E:\\myProject\\bin\\Debug\\netcoreapp3.1\\{assemblyName}";
// this returns true
var exists = File.Exists(archSpecificPath);
try
{
return System.Reflection.Assembly.LoadFile(archSpecificPath);
}
catch(Exception e)
{
// e's value: "An attempt was made to load a program with an incorrect format. (0x8007000B)"
return null;
}
EDIT 2 - bin 的内容及其来源
packages\cefsharp.common.netcore\89.0.170\runtimes\win-x64\lib\netcoreapp3.1
CefSharp.Core.dll
CefSharp.dll
CefSharp.Core.Runtime.dll
packages\cefsharp.offscreen.netcore\89.0.170\lib\netcoreapp3.1
CefSharp.OffScreen.dll
EDIT 3 - 更新的 bin
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。