Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to locate required Cef/CefSharp dependencies

I have a C# console application that is deployed on client machines. While deploying in client machine I get System.TypeInitializationException.

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

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

like image 519
MAHA RAJA Avatar asked Dec 19 '22 10:12

MAHA RAJA


1 Answers

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!

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!):

  • Add <probing privatePath="x86"/> to your app.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 = @"x86\CefSharp.BrowserSubprocess.exe"; when calling Cef.Initialize

example below:

[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);
}

Note: when using this code, I would still advise you to use performDependencyCheck: true since it will now report only genuine errors.

like image 126
Gyum Fox Avatar answered Dec 24 '22 00:12

Gyum Fox