我是第一次设置 CefSharp。我已经安装了 NuGet CefSharp.WinForms 版本 99.2.90。我已经在 x64 和 x86 版本中运行了它。 x64 引发了 DLL 错误,这表明它应该在 x86 中构建。 我尝试了很多在网上找到的不同方法,但简单地启动 CefSharp 就会引发错误。
运行 chromeBrowser = new ChromiumWebBrowser("www.google.com");结果出现以下错误:
[0315/133306.821:ERROR:gpu_process_host.cc(972)] GPU process exited unexpectedly: exit_code=-532462766
[0315/133306.821:WARNING:gpu_process_host.cc(1277)] The GPU process has crashed 6 time(s)
[0315/133306.821:FATAL:gpu_data_manager_impl_private.cc(447)] GPU process isn't usable. Goodbye.
The program '[18264] CefSharp.exe' has exited with code 1073741855 (0x4000001f).
表格代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp.WinForms;
using CefSharp;
using System.Threading;
using System.IO;
using System.Diagnostics;
using CefSharp.DevTools.IO;
namespace TemarkNamespace
{
public partial class CefSharpController : Form
{
private ChromiumWebBrowser chromeBrowser;
public CefSharpController()
{
InitializeComponent();
chromeBrowser = new ChromiumWebBrowser("www.google.com");
}
private void FormClosed(object sender, FormClosedEventArgs e)
{
Cef.Shutdown();
}
}
}
事件查看器错误:
Application: CefSharp.BrowserSubprocess.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.BadImageFormatException
at CefSharp.BrowserSubprocess.Program.Main(System.String[])
我错过了说明https://github.com/cefsharp/CefSharp/blob/cefsharp/99/NuGet/Readme.txt#L13 我创建了 app.manifest 文件并且效果很好。感谢您的帮助,amaitland!