CefSharp - Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies

匿名 (未验证) 提交于 2019-12-03 01:38:01

问题:

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).

回答1:

Recently i had a similar issue. But even in release mode i had the same issue. Going through Github cefsharp FAQs that similar link.

The NOTE 2 solved my issue

If compiling from source (not recommended, use the Nuget packages) and you notice that you can no longer build in debug mode, but release builds work just fine you may need to repair your version of Visual Studio. This happens in rare cases where you will get the same exact message as a missing unmanaged .dll file as shown above.

Had to repair visual studio and all started working as before.



回答2:

First, make sure you installed the the VC++ distribution:

Cefsharp v65 and above, download VC++ 2015 Redist, older CefSharp versions use VC ++ 2013 Redist.

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 mentioned 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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!