cefsharp.wpf:试图加载组装时Fileloadexception

发布于 2025-02-05 12:22:19 字数 1209 浏览 2 评论 0 原文

我们有一个旧的旧应用程序,该应用程序正在使用MS Access运行。我们正在将其迁移到WPF。为此,我们创建了一个 winforms 控件,这在 element -host 中显示了我们的新WPF东西。然后,此 WinForms 控制在COM OCX中以某种方式使用,然后将其放置在MS访问表单上。到目前为止,这起作用了,暂时就是这样,我无法更改它。

到目前为止,我们使用了内置的 WebBrowser 从.NET控件显示网站,但是由于此控件基于IE 11,因此我们正在寻找替换。 WebView2 ElementHost 中不起作用,因此现在我们正在研究和测试WPF的CEFSHARP 。

到目前为止,在我所有的独立测试中,它都可以使用,但是当我今天尝试将其集成到我们的软件中时,我偶然发现了一个问题,我不确定如何解决这个问题。

当我将 Chromiumwebbrowser CEFSHARP 控制到我们的WPF窗口并运行我们的软件,我得到了 io.fileleloadexception file CEFSHARP .wpf 。用 fuslogvw.exe 检查一下,该.NET在目录中查找该文件,其中 msacces.exe 位于位置,可能是因为这实际上是执行程序集。

因此,我注册了 appdomain.currentdomain.semblylesolve 事件,以手动从其位置加载必要的文件。这适用于

  • cefsharp.wpf
  • cefsharp
  • cefsharp.core

,但随后尝试加载 cefsharp.core.core.core.runtime ,我得到了 io.fileleloadexception (此文件或在加载此组件时找不到其依赖项之一。我认为它试图找到自己的依赖项之一(非.NET),并在错误的位置寻找它(也许再次是MS Access Directory?)。

您是否有任何建议,我该如何判断 cefsharp 的依赖项(直接或间接)可以在其中找到它们以及应该从何处加载它们?

We have an old legacy application that is running with MS Access. We are in the process of migrating it to WPF. For that we created a WinForms control, that is showing our new WPF stuff in an ElementHost. This WinForms control is then somehow used in a COM ocx which then is placed on a MS Access form. This works so far, and for the time being this is like it is and I can't change it.

Until now we used the built-in WebBrowser control from .NET to show web sites, but since this control is based on IE 11, we are looking for a replacement. WebView2 is not working in an ElementHost, so now we are investigating and testing CefSharp for WPF.

In all of my stand-alone tests it worked so far, but when I tried to integrate it into our software today I stumbled upon a problem and I'm not sure how to fix that.

When I put the ChromiumWebBrowser control from CefSharp onto our WPF window and ran our software I got an IO.FileLoadException for the file CefSharp.Wpf. Checking that with fuslogvw.exe I've seen, that .NET looked for that file in the directory where the MSAccess.exe is situated, probably because this in fact is the executing assembly.

So I registered an AppDomain.CurrentDomain.AssemblyResolve event to manually load the necessary files from where they are situated. This worked for

  • CefSharp.Wpf
  • CefSharp
  • CefSharp.Core

But then it tried to load CefSharp.Core.Runtime and although this assembly is present I get an IO.FileLoadException (this file or one of its dependencies can't be found) when loading this assembly. I assume that it tries to find one of its own dependencies (non .NET) and looks for it in the wrong place (maybe the MS Access directory again?).

Do you have any suggestions how I can tell CefSharp and all of its dependencies (direct or indirect) where they can be found and where they should be loaded from?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文