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
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 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 = @"x86\CefSharp.BrowserSubprocess.exe";
when callingCef.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With