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

我与影子孤独终老i 提交于 2020-11-30 04:34:25

问题


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?


回答1:


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



回答2:


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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/12224798/any-reason-to-prefer-cefsharp-over-cefglue-or-vice-versa

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