Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#-带有Gecko和xul的Windows窗体_C#_Xul_Gecko_Xulrunner_Geckofx - Fatal编程技术网

C#-带有Gecko和xul的Windows窗体

C#-带有Gecko和xul的Windows窗体,c#,xul,gecko,xulrunner,geckofx,C#,Xul,Gecko,Xulrunner,Geckofx,我在将Gecko与XUL集成到C#中时遇到了一些问题 1/我已经下载了geckofx45.45.0.34.nupkg。有了这些,我在“.zip”中重命名了它的扩展名,并解压缩了这个文件夹。我有很多目录 2/然后,我在C#(.NET Framework 4.5.2)中创建了一个windows窗体应用程序。通过“解决方案资源管理器”,我添加了两个由步骤1生成的库(Geckofx-Core.dll和Geckofx-Winforms.dll) 3/然后,在工具箱中的“所有Windows窗体”折叠中,我右

我在将Gecko与XUL集成到C#中时遇到了一些问题

1/我已经下载了geckofx45.45.0.34.nupkg。有了这些,我在“.zip”中重命名了它的扩展名,并解压缩了这个文件夹。我有很多目录

2/然后,我在C#(.NET Framework 4.5.2)中创建了一个windows窗体应用程序。通过“解决方案资源管理器”,我添加了两个由步骤1生成的库(Geckofx-Core.dll和Geckofx-Winforms.dll)

3/然后,在工具箱中的“所有Windows窗体”折叠中,我右键单击并“选择项”。然后,在“.NETFramework组件”选项卡中,我添加了Geckofx-Winforms.dll

4/我已重新启动Visual Studio 2015

5/然后,我再次打开我的项目,并将工具箱中的“GeckoBrowser”组件添加到我的窗口中

6/然后,我完成了我的项目。没关系。但是,当我尝试执行我的应用程序时,我遇到了一个问题:

An unhandled exception of type 'System.DllNotFoundException' occurred in Geckofx-Core.dll
Additional information: Unable to load DLL 'xul': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
因此,我在上下载了xulrunner并解压缩了该文件。结果:C:\xulrunner\xulrunner-41.0.2.en US.win32\xulrunner\

7/然后,在我的项目属性的“引用路径”中,我添加了路径C:\xulrunner\xulrunner-41.0.2.en US.win32\xulrunner\

8/我再次启动了我的应用程序,但屏幕上总是出现相同的错误

我也尝试过使用“TlbImp.exe”,但没有成功


你能帮我吗

我使用的方法需要将xulrunner文件夹放到app文件夹中,然后使用以下方法:

private void InitializeGeckoEngine()
    {

        try
        {
            if (!Directory.Exists(Paths.XulRunner))
            {
                MessageBox.Show($"Firefox folder not found at {Paths.XulRunner}!");
            }

            Xpcom.EnableProfileMonitoring = false;
            Xpcom.Initialize(Paths.XulRunner);

        }
        catch (Exception ex)
        {
            MessageBox.Show($"Firefox engine not detected or was not loaded correctly. Loading path: {Paths.XulRunner}. Exception details:\n" + ex + ex.InnerException, "Error",
                MessageBoxButton.OK, MessageBoxImage.Error);

        }
    }

关键部分当然是Xpcom.Initialize()调用。

为什么要下载
nupkg
而不是在项目引用中添加nuget引用?我的计算机上没有internet