如何解决无法加载CefSharp
我遇到的问题与此类似:
Publish Could not load file or assembly CefSharp.Core.dll
我正在为使用C#编写的较大的.NET桌面应用程序开发插件。较大的父应用程序包含旧版本的Chromium(大约2年),我的插件的目的是加载和使用最新版本的Chromium。父应用程序,我的插件和CefSharp都以x86为目标。
文件夹结构看起来像这样:
C:\...\ParentApp\ParentApp.exe
C:\...\ParentApp\CefSharp.dll (version 71)
C:\...\ParentApp\CefSharp.Core.dll (v71)
C:\...\ParentApp\CefSharp.WinForms.dll (v71)
C:\...\ParentApp\...etc... (v71)
C:\...\ParentApp\plugins\MyPlugin\MyPlugin.dll (references and loads version 83.4.20)
C:\...\ParentApp\plugins\MyPlugin\CefSharp.dll (v83)
C:\...\ParentApp\plugins\MyPlugin\CefSharp.Core.dll (v83)
C:\...\ParentApp\plugins\MyPlugin\CefSharp.WinForms.dll (v83)
C:\...\ParentApp\plugins\MyPlugin\...etc... (v83)
父应用很少使用Chromium,因此我的插件实际上首先运行,并且在加载时仅运行基本初始化:
CefSettings settings = new CefSettings();
Cef.Initialize(settings);
我可以通过Process Monitor(Procmon)看到它首先从插件位置(即v83)加载了所有文件,尽管它也可以查看并检查v71文件。
在“ new CefSettings()”行之后,我还用以下命令注入了当前程序集的转储:
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
...我可以看到它确实已经加载了3个主要程序集(CefSharp.Core,CefSharp.WinForms和CefSharp),其版本为83.4.20.0,这是正确的版本。
但是一旦我点击Cef.Initialize(settings),它就会触发异常:
FileNotFoundException: Could not load file or assembly 'CefSharp,Version=83.4.20.0,Culture=neutral,PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. The system cannot find the file specified.
at CefSharp.Internals.CefSharpApp.OnBeforeChildProcessLaunch(CefSharpApp*,scoped_refptr<CefCommandLine>* commandLine)
FileNotFoundException: Could not load file or assembly 'CefSharp,PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. The system cannot find the file specified.
at CefSharp.Internals.CefSharpApp.OnContextInitialized(CefSharpApp* )
我已经尝试了多种方法,包括在单独的应用程序域中设置所有内容,但这会遇到其他问题。
有人对这个问题有什么想法吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。