52

In the realm of providing a decent implementation of the Chromium Embedded Framework (CEF) for .Net, the two leading options appear to be CefSharp and CefGlue. They differ in approach (CefGlue uses P/Invoke to call into the CEF unmanaged code, CefSharp uses a mixed-mode C++/CLI wrapper around the CEF libraries).

Is there some reason that a mixed-mode assembly is better than P/Invoke calls? All other things being equal, it seems like CefGlue (the P/Invoke lib) provides a "thinner" wrapper around the CEF project, which means it would probably be faster to respond to updates in the upstream library.

Is there anyone out there with experience with both libraries who can share what the differentiating factors would be?

Drew Shafer
  • 4,520
  • 4
  • 28
  • 40
  • 14
    CefSharp maintainer here. Not sure why this was closed. CefGlue has the advantage of being able to run in Mono, for example. CefSharp provides WinForms and WPF controls. Both respond to updates in the upstream library reasonably fast. I'm in touch with the maintainer of CefGlue, he's a good guy. Just use whatever feels right. There are google groups set up for both the CefSharp and CefGlue projects, feel free to ask any other questions you might have there. – anthony Sep 06 '12 at 20:11
  • 1
    I'm not sure either - possibly because the (generic) merits of P/Invoke vs. C++/CLI wrappers have been discussed on this site already elsewhere. For what it's worth, I've settled on CefSharp (as you might have guessed from my recent pull request). I'll continue to follow both projects, though... – Drew Shafer Sep 07 '12 at 14:30
  • 8
    why the hell was this closed? – KJW Feb 18 '13 at 18:36
  • @anthony After 2 intensive days with CefSharp, I do feel that most of the "deeper stuff" isn't (intentionally?) implemented in CefSharp but only in CefGlue. E.g. accessing the DOM, certain events, etc. Probably have to switch to CefGlue or contribute to CefSharp (if I finally do unterstand that Github stuff). – Uwe Keim May 30 '13 at 14:37

4 Answers4

22

In some sense they are about the same and whichever you'd pick you should be able to get away with in 2014. We had this question some time ago and here what we have comeup with:

CefSharp

Pluses:

  1. The WinForms is very old and mature project. If you are to use WinForms it is probably the way to go;
  2. It has a NuGet bundle, so it is easy to use and update;
  3. Supports newer version of WPF (.NET 4+);

Minuses:

  1. As @Uwe Keim had mentioned they just recently finally started to support WPF, so it is not as mature as Xillium.CefGlue;
  2. Community isn't that receptive to your needs;
  3. No Mono support.

CefGlue

Pluses:

  1. It is .NET 2.0 friendly. Your code will be able to run on it. (This was critical for us)
  2. A very responsive community which would help you to get what you need done/fixed;
  3. More mature support for WPF;
  4. Mono support.

Minuses:

  1. No NuGet package as far as I know, you'd need to add libraries and update them yourself
RA.
  • 779
  • 6
  • 26
Artem
  • 7,034
  • 15
  • 55
  • 87
  • Where do you get support for CefGlue? The bitbucket site is hardly ever updated. – Tsury Feb 06 '15 at 16:27
  • 1
    On bitbucket the user with name fddima is the owner of the repository. I contacted him. At the time I was working on that he was very responsive to the tickets I would open and to the PRs I submit. Not sure if it changed since. – Artem Feb 06 '15 at 23:39
  • @Tsury: Support for CefGlue can be found here: http://magpcss.org/ceforum/viewforum.php?f=14 – Sjoerd222888 Aug 25 '15 at 14:41
  • 5
    CefSharp [doesn't seem to support Mono](https://github.com/cefsharp/CefSharp/issues/114). – cubuspl42 Oct 17 '15 at 13:59
  • @cubuspl42: CefSharp uses C++.NET, which is only supported on Windows, even in .NET-Core. – Stefan Steiger Mar 12 '19 at 00:51
19

It is 2018. The project fortunes have changed quite a bit. CefSharp is alive and well with almost daily updates in the GitHub depository. Issues are getting resolved, currently only 57 open issues and 1787 closed. CefGlue does not seem to do well. The mailing lists are moribund, there have not been recent updates. There are two forks at GitHub that resolved issues beyond the last released CefGlue version.

The fundamentals have otherwise not changed. CefSharp takes a dependency on C++/CLI code, originally an easy way to get the .NET-to-C++ interop going. But that can only work on a Windows machine and in a project that targets the full desktop version of the .NET Framework.

But not Mono, not .NET Core (relevant to Xamarin and UWP apps), or any library or project that is meant to be portable to another OS. C++/CLI is not an option in such a scenario and pinvoke must be the fallback. So CefGlue.

Pang
  • 8,605
  • 144
  • 77
  • 113
Hans Passant
  • 873,011
  • 131
  • 1,552
  • 2,371
14

It is now late 2018 and it is looking grim honestly.

CefSharp, while under active development and has somewhat good documentation, still does not support .NET Core or Mono, rendering it unusable for anything .NET Core, .NET Standard, or Mono related (we exclusively use Linux for production servers so this is a hard no, sadly).

CefGlue, in comparison, apparently does support .NET Core/Mono according to the other posters. However, and this is important, the project moved to GitLab and does not have any license attached to it. The website is also unreachable (at least the one I found) and documentation is nonexistent.

There is a fork here which seems to be inactive again though. There is also an unofficial port to .NET Core here, but that seems to have a hard dependency on Avalonia.

However, there is Chromely, which seems to support cross platform and is based on CefSharp and CefGlue (and unofficial ports of those). It seems like that's a fully fledged browser though and not a library for embedding something in your application.

Since I was initially looking for an easy way to embed a headless browser in my application for crawling purposes (eliminating the need to install Chrome), I also took a look at Awesomium, but they seem to have moved to a new project called "Ultralight", which does not support C# and has no bindings for it at the moment.

As a last effort, there seems to be Optimus, which seems to support .NET Standard and is a full implementation of a WebBrowser in .NET, minus GUI. I'll try that out and maybe edit this answer if it works (or not).

Pang
  • 8,605
  • 144
  • 77
  • 113
Letum
  • 183
  • 1
  • 6
5

To complete Artem's answer, CefSharp only provides basic javascript integration with C# whereas CefGlue offers a much complete integration solution by exposing all javascript bindings offered by CEF.

Regarding Nugets package, I just created CEFGlue nuget packages for .Net 4.5 targeting 3.2272.2035 CEF version : Unofficial.CefGlue.WPF and Unofficial.CefGlue.WindowsForm.

Pang
  • 8,605
  • 144
  • 77
  • 113
David Desmaisons
  • 786
  • 8
  • 14
  • Nice! Will you maintain these packages? – Sören Kuklau Sep 21 '15 at 09:39
  • Recently, there was a good move from the community in order to make official package and integrate them to CEFGlue release process see: [associated Gitbuckect issue](https://bitbucket.org/xilium/xilium.cefglue/issues/61/make-nuget-packages) – David Desmaisons Sep 22 '15 at 11:56