无法找到所需的Cef/CefSharp依赖项

MAH*_*AJA 3 c# 64-bit console-application chromium-embedded cefsharp

我有一个部署在客户端计算机上的C#控制台应用程序.在客户端计算机中部署时,我得到System.TypeInitializationException.

在debug.log中,我收到以下错误:

Unable to locate required Cef/CefSharp dependencies:
Missing:CefSharp.BrowserSubprocess.exe
Missing:CefSharp.BrowserSubprocess.Core.dll
Missing:CefSharp.Core.dll
Missing:CefSharp.dll
Missing:icudtl.dat
Missing:libcef.dll
Executing Assembly Path:C:\myapp
Run Code Online (Sandbox Code Playgroud)

问题是所有文件都存在于C:\ myapp目录中(如此处所指定).因此,我不确定为什么这些文件没有被加载.msvcp120.dll,msvcr120.dll,vccorlib120.dll也包含在c:\ myapp目录中

Gyu*_*Fox 7

和很多人一样,我按照官方快速入门文章中的步骤来设置"任何CPU"配置,并且performDependencyCheck在启用时遇到了缺少依赖项的问题.

这是因为文章实际上是不完整的!

要使"任何CPU"配置生效,您需要按照功能请求中的所有步骤- 添加AnyCPU支持#1714(特别是最后一个!):

示例如下:

[STAThread]
public static void Main()
{
  var settings = new CefSettings();
  settings.BrowserSubprocessPath = @"x86\CefSharp.BrowserSubprocess.exe";

  Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);

  var browser = new BrowserForm();
  Application.Run(browser);
}
Run Code Online (Sandbox Code Playgroud)

注意:使用此代码时,我仍然建议您使用,performDependencyCheck: true因为它现在只报告真正的错误.