问题
Have used CefSharp to use the chromium web browser in a WPF project. The build works as expected, but when published, the error received is:
The invocation for the constructor on type 'CefSharp.Wpf.ChromiumWebBrowser' that matches the specific binding constraints threw an exception.' Line number '24' and line position '15'. IsTerminating:True
Have followed the advise here:
https://github.com/cefsharp/CefSharp/issues/2030
Which unfortunately has not yielded any results, have also followed the read me here:
https://github.com/cefsharp/cef-binary/blob/master/README.txt#L82
The files exist in the published directory, but in the event viewer, the error:
Application: APP.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException at CefSharp.Wpf.ChromiumWebBrowser.NoInliningConstructor() at CefSharp.Wpf.ChromiumWebBrowser..ctor()
Any assistance appreciated, as am not sure where else to look to resolve.
回答1:
You should install vc++ redist 2013(x86 or x64) on the target computer. vc++ redist 2015 doesn't work.
Download available from here:
Visual C++ Redistributable Packages for Visual Studio 2013
回答2:
I had this problem after updating the NuGet package. I realized that my installer was copying dependencies from a folder named "Needed" where I had previously painstakingly collected all of the files needed to run the application (with lots of unmanaged things). So when I ran the exe from the build folder it worked fine, but when I installed it, it crashed because all of the DLLs were for the previous version. A quick fix for me was to just copy all of the contents of my build folder to the silly "Needed" folder I had previously made.
Hopefully I'll find this a year from now when it happens again.
来源:https://stackoverflow.com/questions/44848820/cefsharp-wpf-error