如何在具有动态加载程序集的 .NET WinForms 应用程序中使用 WebKit.NET 或 GeckoFX?

发布于 2024-08-16 12:24:19 字数 292 浏览 4 评论 0原文

我正在开发一个 .NET WinForms 应用程序,该应用程序在运行时从单独的程序集中加载表单和其他 UI 元素。这效果很好。

但是,我正在加载的程序集之一具有使用 GeckoFX 或 WebKit.NET 嵌入 Web 浏览器控件的表单。当我尝试使用 Assembly.CreateInstance() 加载该程序集时,我收到一个异常,指出它找不到我尝试加载的程序集,即使它在那里。一切都构建得很好,并且具有正常构建/链接的单独测试应用程序可以与这些控件一起正常工作。

这里有什么想法吗?

谢谢,

马特

I'm working on a .NET WinForms application that loads forms and other UI elements from separate assemblies at runtime. This works well.

However, one of the assemblies I'm loading has a form that uses either GeckoFX or WebKit.NET to embed a web browser control. When I try to load that assembly with Assembly.CreateInstance() I'm getting an exception saying that it can't find the assembly I'm trying to load, even though it's there. Everything builds fine and a separate test application with a normal build / link works fine with these controls.

Any ideas here?

Thanks,

Matt

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

吐个泡泡 2024-08-23 12:24:19

您可以尝试使用Fusion Log Viewer来查找哪个依赖项未加载。这假定依赖项是未加载的 .NET 程序集。如果是通过 P/Invoke 丢失的程序集,情况会更复杂。

You can try using Fusion Log Viewer to find which dependency is not loading. This assumes the dependency is a .NET assembly which is not being loaded. If it is a assembly missing via P/Invoke it will be more complicated.

神经暖 2024-08-23 12:24:19

确保所有依赖项以及您尝试加载的程序集都是可定位的。

如果这样做,您应该能够很好地使用任一程序集。

Make sure that all of the dependencies are locatable, as well as the assembly you are trying to load.

If you do that, you should be able to use either assembly just fine.

蓝天白云 2024-08-23 12:24:19

这可能在两种情况下发生

  1. 对于 geckofx,您的系统中没有 xulrunner,您需要在代码中添加此行
    加载 xulrunner - Skybound.Gecko.Xpcom.Initialize(@"path to xulrunner");

  2. 如果你在 64 位机器上,那么你会得到一个异常,你需要为 32 位版本构建它。

This can happen in 2 conditions

  1. For geckofx, you dont have xulrunner in your system, you need to add this line in your code
    to load xulrunner - Skybound.Gecko.Xpcom.Initialize(@"path to xulrunner");

  2. If you are on a 64 bit machine, then you will get an exception, you need to build it for 32 bit version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文