Any reason to prefer CefSharp over CefGlue (or vice-versa)?
Asked Answered
T

4

55

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?

Trope answered 1/9, 2012 at 4:5 Comment(4)
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.Cosmopolis
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...Trope
why the hell was this closed?Kotta
@Cosmopolis 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).Waxen
A
21

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
Adscription answered 19/3, 2014 at 16:46 Comment(5)
Where do you get support for CefGlue? The bitbucket site is hardly ever updated.Clareclarence
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.Adscription
@Tsury: Support for CefGlue can be found here: magpcss.org/ceforum/viewforum.php?f=14Benjie
CefSharp doesn't seem to support Mono.Spermiogenesis
@cubuspl42: CefSharp uses C++.NET, which is only supported on Windows, even in .NET-Core.Therm
F
23

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.

Frostbitten answered 1/9, 2012 at 4:5 Comment(2)
Well, looks like we really need something new for the multiplatform support.Forgather
CefGlue has been recently updated and supports Chrome 68 (but still no official Nuget package).Allotropy
A
21

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
Adscription answered 19/3, 2014 at 16:46 Comment(5)
Where do you get support for CefGlue? The bitbucket site is hardly ever updated.Clareclarence
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.Adscription
@Tsury: Support for CefGlue can be found here: magpcss.org/ceforum/viewforum.php?f=14Benjie
CefSharp doesn't seem to support Mono.Spermiogenesis
@cubuspl42: CefSharp uses C++.NET, which is only supported on Windows, even in .NET-Core.Therm
I
16

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

Incoercible answered 27/10, 2018 at 12:47 Comment(2)
Optimus have a way to generate an image?Bagel
2021, no traces of Optimus. I guess it did not work.Gorman
L
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.

Lynettalynette answered 30/6, 2015 at 1:23 Comment(2)
Nice! Will you maintain these packages?Pandurate
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 issueLynettalynette

© 2022 - 2024 — McMap. All rights reserved.