CefSharp: Could not load file or assembly CefSharp.Core.Runtime

1k Views Asked by At

I get the exception CefSharp: Could not load file or assembly CefSharp.Core.Runtime. I found similar questions with CefSharp.Core.dll or CefSharp.Core.Runtime.dll, but in my case it is with CefSharp.Core.Runtime, without dll.

I installed CefSharp.OffScreen 96.0.180.0 using nuget.

I installed the latest supported Microsoft Visual C++ Redistributable packages for Visual Studio 2022. I have all the required files. I followed these steps (although the error in my case is with the Core.Runtime).

My code:

string url = "MY_URL";
using (var browser = new ChromiumWebBrowser(url))
   {
      var initialLoadResponse = await browser.WaitForInitialLoadAsync(); <- ERROR!!!
      var html = await browser.GetBrowser().MainFrame.GetSourceAsync();
      HERE_I_DO_SOME_STUFF_WITH_MY_HTML;
   }

It breaks when I try to get the initial load response.

I also get the messages

Exception thrown: 'System.IO.FileNotFoundException' in CefSharp.OffScreen.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll

in the console.

My app is .net462.

I looked at several questions in SO and none of them worked. The only one I didn't try is the x64 vs x86 solution because I don't understand the consequences (if I change it, will it affect to the other developers? will it compile in the Azure server?). The only thing I did here is adding the following lines in the csproj file: enter image description here

I have these files in bin/Debug:

Debug folder

I have these files in bin/Debug/x64:

x64 folder

The folder bin/Debug/x86 looks exactly the same as bin/Debug/x64.

I had previously installed CefSharp in a POC in the same solution, in a project in .net6 and it worked without any issue.

Any ideas?

0

There are 0 best solutions below