无法找到所需的 Cef/CefSharp 依赖项 [英] Unable to locate required Cef/CefSharp dependencies
问题描述
我有一个部署在客户端计算机上的 C# 控制台应用程序.在客户端机器上部署时,我得到 System.TypeInitializationException.
I have a C# console application that is deployed on client machines. While deploying in client machine I get System.TypeInitializationException.
在 debug.log 中,我收到以下错误:
In debug.log, I get the following errors:
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
问题是所有文件都存在于 C:myapp 目录中(如此处指定).因此,我不确定为什么没有加载这些文件.还有 msvcp120.dll、msvcr120.dll、vccorlib120.dll 包含在 c:myapp 目录中
The problem is that all files are present in the C:myapp directory (as specified here). Therefore, I'm not sure why these files aren't being loaded up. Also msvcp120.dll, msvcr120.dll, vccorlib120.dll included in c:myapp directory
推荐答案
和很多人一样,我按照官方快速入门文章 设置任何 CPU"配置,我遇到了同样的问题,缺少performDependencyCheck
开启时的依赖项.
As many people, I followed the steps in the official Quick Start article to setup the "Any CPU" configuration and I had the same problem with missing dependencies when performDependencyCheck
was on.
这是因为文章实际上不完整!
This is because the article is actually incomplete!
要使Any CPU"配置工作,您需要按照功能请求中的所有步骤进行操作- 添加 AnyCPU 支持 #1714(尤其是最后一个!):
For the "Any CPU" configuration to work, you need to follow all the steps in Feature Request - Add AnyCPU Support #1714 (especially the last one!):
- 将
<probing privatePath="x86"/
> 添加到您的app.config
,如 https://msdn.microsoft.com/en-us/library/4191fzwb.aspx - 在您的项目属性中设置
Prefer 32bit
参见 http://blogs.microsoft.co.il/sasha/2012/04/04/what-anycpu-really-mean-as-of-net-45-and-visual-studio-11/一些背景 - 在调用时设置
settings.BrowserSubprocessPath = @"x86CefSharp.BrowserSubprocess.exe";
Cef.Initialize
- Add
<probing privatePath="x86"/
> to yourapp.config
as outlined in https://msdn.microsoft.com/en-us/library/4191fzwb.aspx- Set
Prefer 32bit
in your project properties see http://blogs.microsoft.co.il/sasha/2012/04/04/what-anycpu-really-means-as-of-net-45-and-visual-studio-11/ for some background- Set
settings.BrowserSubprocessPath = @"x86CefSharp.BrowserSubprocess.exe";
when callingCef.Initialize
示例如下:
[STAThread]
public static void Main()
{
var settings = new CefSettings();
settings.BrowserSubprocessPath = @"x86CefSharp.BrowserSubprocess.exe";
Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
var browser = new BrowserForm();
Application.Run(browser);
}
注意:在使用此代码时,我仍然建议您使用 performDependencyCheck: true
因为它现在只会报告真正的错误.
Note: when using this code, I would still advise you to use performDependencyCheck: true
since it will now report only genuine errors.
这篇关于无法找到所需的 Cef/CefSharp 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!