I've been working on a CefSharp WinForms app for a few weeks and I've had no issues with it. This morning, while adding a few things to the application, I tried to run it to test something and got the below error:
System.IO.FileNotFoundException was unhandled Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll Additional information: Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies. The specified module could not be found.
After searching for a while I found this:
https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#Runtime_dependencies
I checked bin/Debug/x86 for the project and all of the dependencies appear to be present. More importantly, it had been working fine five minutes earlier, and I didn't touch anything beyond a single class for an Entity Framework migration.
I've tried cleaning and rebuilding the solution, restarting Visual Studio, restarting my PC, and clearing out /bin/Debug, and none of these have helped.
Why would this error appear now after several days without it, and how can I resolve the issue?
Edit: I've done some further experimenting and I'm able to get the application to run in Release mode but not Debug mode. If I change the output path of Release mode to Debug, it fails with the same error (likewise, it succeeds in Debug with the Release output path).
First, make sure you installed the VC++ distribution:
You could download the proper version from https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads
Second, which I didn't see people mention this before, and I found this solution after I was working with the issue for several hours:
Some CefSharp version needs CRT pack. Please find them at "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs", choose the proper version folder (x86 or x64, depends on your CefSharp target), copy all files into the release folder of your project.