I created a new console project and used NuGet to add CefSharp.Common
and CefSharp.OffScreen
.
I added the following code:
static void Main(string[] args)
{
try
{
ChromiumWebBrowser Chromium = new ChromiumWebBrowser("www.google.com");
}
catch (Exception ex)
{
Console.WriteLine(ex);
Console.WriteLine(ex.Message);
}
Console.WriteLine("Test Complete Press Enter to Close Window");
Console.ReadLine();
}
I then published the project and attempted run it and I received this error: System.IO.FileLoadException: A procedure imported by 'CefSharp.Core.Runtime.dll' could not be loaded.
The following files are in the published folder
CefSharp_Test.exe
CefSharp_Test.exe.config.deploy
CefSharp_Test.exe.deploy
CefSharp_Test.exe.manifest
CefSharp.Core.dll.deploy
CefSharp.Core.Runtime.dll.deploy
CefSharp.dll.deploy
CefSharp.Offscreen.dll.deploy
I saw that CefSharp recently pushed a change that created the CefSharp.Core.Runtime.dll
- https://github.com/cefsharp/CefSharp/issues/3319 and I assume the issue is in some way related to CefSharp determining if the x86 or x64 Runtime.dll
should be used but I have been unable to find a way to resolve the issue.
The project does run without issues from Visual Studio.
Edit - From the CefSharp readme it appears that libcef.dll
, icudtl.dat
, CefSharp.BrowserSubprocess.exe
, and CefSharp.BrowserSubprocess.Core.dll
are required dependencies. I have added those files to the project, set to copy always, and re-published. The error now reads System.IO.FileNotFoundException: Could not load file or assembly 'CefSharp.Core.Runtime.dll' or one of its dependencies. The specified module could not be found.
Edit - It appears that this is a known issue and will be fixed in a future release of CefSharp. https://github.com/cefsharp/CeSharp/pull/3391
Edit - I attempted to run it using the CefSharp v88.2.40-pre and received the same error.
Edit - CefSharp v88.2.40 has been released. I have attempted to run with that and received the same error.