Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CefSharp.Core unable to load when published (ClickOnce) #625

Closed
dtbiedrzycki opened this issue Nov 20, 2014 · 21 comments
Closed

CefSharp.Core unable to load when published (ClickOnce) #625

dtbiedrzycki opened this issue Nov 20, 2014 · 21 comments

Comments

@dtbiedrzycki
Copy link

Hey all,

I've recently created a project using the latest Prerelease version through NuGet. It runs swimmingly through Visual Studio, however, when I publish the application (through VS creating the one click install type of application), the installed application always fails to start.

When I've been able to catch the error, it states that it was unable to load the CefSharp.Core dependency. I've tinkered with the cef.redist package as well and got it so that the application would install and actually open a window, but the browser fails to load properly.

Now this could be my own mistake as I'm new to publishing applications, but I haven't had this problem with other small projects that have third party dependencies.

So far I've tried building in both x86 and x64 as well as building in a specific configuration and removing the unnecessary references (i.e. build in x86 and remove all x64 references). That didn't seem to change anything. When I've looked at the other issues listed here, they seemed to be revolving around errors while in VS, not in a published application, so I thought this would still be fit as a new issue.

@dtbiedrzycki
Copy link
Author

UPDATE:

I was able to get this to work. I kept digging through the existing issues and found (this)[https://github.com//issues/500]

I had to modify one of the responses further; here is what I did

  • copy over all of the dlls in cef.redist.3.1750.1738\CEF\x[you-choose]
  • copy over all .pak files in cef.redist.3.1750.1738\CEF (and make them always copy and build action of 'Content')
  • add .\packages\CefSharp.Common.33.1.0-pre01\CefSharp\x[you-choose]\CefSharp.BrowserSubprocess.Core.dll as a reference
  • for what it's worth, I've also included the CefSharp.BrowserSubprocess.Core.exe (but it didn't work until I added the reference to the .dll)

@amaitland
Copy link
Member

@dtbiedrzycki Excellent, glad you managed to sort this yourself 👍

@jornh jornh changed the title CefSharp.Core unable to load when published CefSharp.Core unable to load when published (ClickOnce) Nov 21, 2014
@jornh
Copy link
Contributor

jornh commented Nov 21, 2014

I'd second @amaitland's praise. Thanks that you took the time to document for others to find 😄 appreciated! Welcome to CefSharp land.

I took the liberty to link to your https://github.com/dtbiedrzycki/SlackWindowsApp, where I see you applied what you learned. Apparently there's now both a WPF and a WinForms CefSharp based http://slack.com client 💃

@dtbiedrzycki
Copy link
Author

No problem guys! Glad I could help at least in some small form.

Now, the problem that I was having; is that expected behavior or is there something I can help with so that the correct dll's are where they need to be when publishing?

@amaitland
Copy link
Member

Unless ClickOnce has improved it's handling of native assemblies then I'm not sure there is much that can be done other than manually deal with the problem (I personally embed the dll's in the assembly and copy them to the bin folder on application startup, it's a little crude, though reliable).

There are alternatives to ClickOnce as mentioned here #500 (comment)

@stepanets
Copy link

Hi, I dont understand where should I copy dlls

@jankurianski
Copy link
Member

@stepanets The full source for a working example is available at https://github.com/dtbiedrzycki/SlackWindowsApp - have you checked to see what it does?

@stepanets
Copy link

What exactly should I check? I dont see dll and pak files in this project.

@amaitland
Copy link
Member

For CefSharp to run all the CEF dependencies need to be in the same directory as your executable.

@stepanets
Copy link

I copy dependencied to project, it works fine if I run application from project Release folder, but after ClickOnce setup I get error in libcef.dll.

@amaitland
Copy link
Member

Have you read #500 as noted above?

@stepanets
Copy link

About SlackWindowsApp - I've published it by clickonce and inslalled and I got same error

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in SlackApp.exe 
Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies. The specified module could not be found.

@amaitland
Copy link
Member

About SlackWindowsApp - I've published it by clickonce and inslalled and I got same error

No, #500 has details on ClickOnce

@stepanets
Copy link

I've read #500. When I add dependencies dlls to my project I get error not about "Could not load file or assembly 'CefSharp.Core.dll'". But error about libcef.dll (sorry for russian lang)
error
When I try debug it I get only

The program '[8660] RealtTranslator.exe' has exited with code 1073741855 (0x4000001f).
The program '[6828] RealtTranslator.vshost.exe: Program Trace' has exited with code 0 (0x0).
The program '[6828] RealtTranslator.vshost.exe' has exited with code 0 (0x0).

@amaitland
Copy link
Member

The exception says that CefSharp.Core.dll cannot find libcef.dll, so check that it's part of your click once distribution and is in the same path as your executable.

You can use the Cef.Initialize dependencyCheck option to confirm all the files are present.

@stepanets
Copy link

This is folder generated by click once
files

@amaitland
Copy link
Member

Have you got VC++ 2012 Update 4 loaded on your target machine?

See what the dependency checker tells you, it'll throw an exception if it can't find key files.

@stepanets
Copy link

@amaitland BIG thx!!! dependencyCheck shows that next dependencies was missed

/loacales
icudtl.dat
CefSharp.BrowserSubprocess.Core.dll
CefSharp.BrowserSubprocess.exe

@Cyberneticist-UK
Copy link

I know this is closed, but I had the same issue and this was a life saver! I also had to do a bit of coding with it to get it working, so I fixed it by:
Referencing as set out here, after removing the references created by NuGet.

I told the settings file NOT to check for dependency:

CefSharp.CefSettings set = new CefSharp.CefSettings();
set.CachePath = CacheStorage;
set.LocalesDirPath = Application.StartupPath + "\Locales";
CefSharp.Cef.Initialize(set, true, false);

Until I did this, I couldn't do ClickOnce, nor would the application open when called as a process or from a shortcut yet WOULD work when double clicking on the Exe file! Took a bit of hunting through log files, and this article to get it sorted!!

@SQ0227
Copy link

SQ0227 commented Jul 29, 2021

Facing same issue.
Can we please have a documented guide on how to resolve such issues rather than going through 100 threads on stackoverflow and git on the same.

@amaitland
Copy link
Member

See #1314 (comment) for details.

Locking this conversation as it's entirely outdated (hasn't been updated since 2016). If you are still having problems then please join in the discussion at #3613

@cefsharp cefsharp locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants