CefSharp Documentation

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework

10,222 stars C# C# 1 file ยท ~5,373 tokens #browser#c-plus-plus#c-sharp#cefsharp#framework#winforms#wpf
RAW Doc

File: README.md





Got a quick question? Discussions here on GitHub is the preferred place to ask!

CefSharp lets you embed Chromium in .NET apps. It is a lightweight .NET wrapper around the Chromium Embedded Framework (CEF) by Marshall A. Greenblatt. About 30% of the bindings are written in C++/CLI with the majority of code here is C#. It can be used from C# or VB, or any other CLR language. CefSharp provides both WPF and WinForms web browser control implementations.

CefSharp is BSD licensed, so it can be used in both proprietary and free/open source applications. For the full details, see the LICENSE file.

If you like and use CefSharp please consider signing up for a small monthly donation, even $25 can help tremendously. See Financial Support for more details.

Releases

Stable binaries are released on NuGet, and contain everything you need to embed Chromium in your .Net/CLR application. For usage see the Quick Start guide or checkout CefSharp.MinimalExample project for basic demos using the CefSharp NuGet packages.

Documentation

  • See the CefSharp.Wpf.Example or CefSharp.WinForms.Example projects for example web browsers built with CefSharp. They demo most of the available features.
  • See the CefSharp.MinimalExample project for a basic demo of using the CefSharp NuGet packages.
  • See the General Usage Guide in help getting started/dealing with common scenarios.
  • See the Wiki for work-in-progress documentation
  • See the FAQ for help with common issues
  • Upgrading from an earlier version of CefSharp? See the ChangeLog for breaking changes and upgrade tips.
  • CefSharp API generated from the source code comments.

Contact

Please keep the Issue Tracker for Bugs only please! Before submitting a PR please read CONTRIBUTING.

Branches & Forks

This is the official CefSharp fork, as maintained by the CefSharp community. You can also view the entire network of public forks/branches.

Development is done in the master branch. New features are preferably added in feature branches, if the changes are more than trivial. New PR's should be targeted against master.

When a new release is imminent a release branch is created. We try to avoid making public facing API changes in release branches (Adding new features is fine, just not breaking changes).

Releases

CI Builds
Every commit on master produces a Nuget package. Use at your own risk!

Pre-release

Stable

Release Branches

With each release a new branch is created, for example the 92.0.260 release corresponds to the cefsharp/92 branch.
If you're new to CefSharp and are downloading the source to check it out, please use a Release branch.

* VC++ 2022 is required starting with version 138
** For NetCore packages .Net 6 or greater is required.

Branch CEF Version VC++ Version .Net Version Status
master 7827 2022* 4.6.2** Development
cefsharp/149 7827 2022* 4.6.2** Release
cefsharp/148 7778 2022* 4.6.2** Unsupported
cefsharp/147 7727 2022* 4.6.2** Unsupported
cefsharp/146 7680 2022* 4.6.2** Unsupported
cefsharp/145 7632 2022* 4.6.2** Unsupported
cefsharp/144 7559 2022* 4.6.2** Unsupported
cefsharp/143 7499 2022* 4.6.2** Unsupported
cefsharp/141 7390 2022* 4.6.2** Unsupported
cefsharp/140 7339 2022* 4.6.2** Unsupported
cefsharp/139 7258 2022* 4.6.2** Unsupported
cefsharp/138 7204 2022* 4.6.2** Unsupported
cefsharp/137 7151 2019* 4.6.2** Unsupported
cefsharp/136 7103 2019* 4.6.2** Unsupported
cefsharp/135 7049 2019* 4.6.2** Unsupported
cefsharp/134 6998 2019* 4.6.2** Unsupported
cefsharp/133 6943 2019* 4.6.2** Unsupported
cefsharp/132 6834 2019* 4.6.2** Unsupported
cefsharp/131 6778 2019* 4.6.2** Unsupported
cefsharp/130 6723 2019* 4.6.2** Unsupported
cefsharp/129 6668 2019* 4.6.2** Unsupported
cefsharp/128 6613 2019* 4.6.2** Unsupported
cefsharp/127 6533 2019* 4.6.2** Unsupported
cefsharp/126 6478 2019* 4.6.2** Unsupported
cefsharp/125 6422 2019* 4.6.2** Unsupported
cefsharp/124 6367 2019* 4.6.2** Unsupported
cefsharp/123 6312 2019* 4.6.2** Unsupported
cefsharp/122 6261 2019* 4.6.2** Unsupported
cefsharp/121 6167 2019* 4.6.2** Unsupported
cefsharp/120 6099 2019* 4.6.2** Unsupported
cefsharp/119 6045 2019* 4.6.2** Unsupported
cefsharp/118 5993 2019* 4.6.2** Unsupported
cefsharp/117 5938 2019* 4.6.2** Unsupported
cefsharp/116 5845 2019* 4.6.2** Unsupported
cefsharp/115 5790 2019* 4.6.2** Unsupported
cefsharp/114 5735 2019* 4.5.2** Unsupported
cefsharp/113 5615 2019* 4.5.2** Unsupported
cefsharp/112 5615 2019* 4.5.2** Unsupported
cefsharp/111 5563 2019* 4.5.2** Unsupported
cefsharp/110 5481 2019* 4.5.2** Unsupported
cefsharp/109 5414 2019* 4.5.2** Unsupported
cefsharp/108 5359 2019* 4.5.2** Unsupported
cefsharp/107 5304 2019* 4.5.2** Unsupported
cefsharp/106 5249 2019* 4.5.2** Unsupported
cefsharp/105 5195 2019* 4.5.2** Unsupported
cefsharp/104 5112 2019* 4.5.2** Unsupported
cefsharp/103 5060 2019* 4.5.2** Unsupported
cefsharp/102 5005 2019* 4.5.2** Unsupported
cefsharp/101 4951 2019* 4.5.2** Unsupported
cefsharp/100 4896 2019* 4.5.2** Unsupported
cefsharp/99 4844 2019* 4.5.2** Unsupported
cefsharp/98 4758 2019* 4.5.2** Unsupported
cefsharp/97 4692 2019* 4.5.2** Unsupported
cefsharp/96 4664 2019* 4.5.2** Unsupported
cefsharp/95 4638 2019* 4.5.2** Unsupported
cefsharp/94 4606 2019* 4.5.2** Unsupported
cefsharp/93 4577 2019* 4.5.2** Unsupported
cefsharp/92 4515 2015* 4.5.2** Unsupported
cefsharp/91 4472 2015* 4.5.2** Unsupported
cefsharp/90 4430 2015* 4.5.2** Unsupported
cefsharp/89 4389 2015* 4.5.2** Unsupported
cefsharp/88 4324 2015* 4.5.2** Unsupported
cefsharp/87 4280 2015* 4.5.2** Unsupported
cefsharp/86 4240 2015 4.5.2 Unsupported
cefsharp/85 4183 2015 4.5.2 Unsupported
cefsharp/84 4147 2015 4.5.2 Unsupported
cefsharp/83 4103 2015 4.5.2 Unsupported
cefsharp/81 4044 2015 4.5.2 Unsupported
cefsharp/79 3945 2015 4.5.2 Unsupported
cefsharp/77 3865 2015 4.5.2 Unsupported
cefsharp/75 3770 2015 4.5.2 Unsupported
cefsharp/73 3683 2015 4.5.2 Unsupported
cefsharp/71 3578 2015 4.5.2 Unsupported
cefsharp/69 3497 2015 4.5.2 Unsupported
cefsharp/67 3396 2015 4.5.2 Unsupported
cefsharp/65 3325 2015 4.5.2 Unsupported
cefsharp/63 3239 2013 4.5.2 Unsupported
cefsharp/62 3202 2013 4.5.2 Unsupported
cefsharp/57 2987 2013 4.5.2 Unsupported
cefsharp/55 2883 2013 4.5.2 Unsupported
cefsharp/53 2785 2013 4.5.2 Unsupported
cefsharp/51 2704 2013 4.5.2 Unsupported
cefsharp/49 2623 2013 4.0 Unsupported
cefsharp/47 2526 2013 4.0 Unsupported
cefsharp/45 2454 2013 4.0 Unsupported
cefsharp/43 2357 2012 4.0 Unsupported
cefsharp/41 2272 2012 4.0 Unsupported
cefsharp/39 2171 2012 4.0 Unsupported
cefsharp/37 2062 2012 4.0 Unsupported

* VC++ 2022 is required starting with version 138
** For NetCore packages .Net 6 or greater is required.

Financial Support

Is your company making money thanks to CefSharp? Do you rely on regular updates to the project? Alex Maitland needs your support! Signup to GitHub Sponsors.

One-Time or Recurring contributions can be made through GitHub Sponsors it only takes a GitHub account and a credit card. You can also make a One-Time contribution via PayPal.

As a stay at home dad I (@amaitland) rely on your contributions to help support my family.

Projects using CefSharp

  • HtmlView : Visual Studio extension bringing CefSharp for showing HTML pages inside VS.
  • SharpBrowser : The fastest web browser for C# with tabbed browsing and HTML5/CSS3.
  • Chromely CefSharp : Build HTML Desktop Apps on .NET/.NET Core 3/.NET 5 using native GUI, HTML5/CSS.

File: CefSharp.Wpf.Example/Controls/TouchKeyboard/Readme.md

Code in this folder is adapted from https://github.com/Microsoft/WPF-Samples/tree/master/Input%20and%20Commands/TouchKeyboard/TouchKeyboardNotifier

Licensed under an MIT license, see https://github.com/Microsoft/WPF-Samples/blob/master/LICENSE

The files aren't included in the .csproj file intentially as they require the Windows 10 SDK

It is reccomended that you obtain and use the https://github.com/Microsoft/WPF-Samples/tree/master/Input%20and%20Commands/TouchKeyboard/TouchKeyboardNotifier
solution provided by Microsoft. It has more advanced features including TouchKeyboardAwareDecorator, which can be used
to resize your window when the touch keyboard is visible. Please read https://github.com/Microsoft/WPF-Samples/blob/master/Input%20and%20Commands/TouchKeyboard/TouchKeyboardNotifier/Readme.md


File: CefSharp/Internals/Partial/Readme.md

The ChromiumWebBrowser class in this folder is not directly included in CefSharp.dll
it is shared between the WPF, OffScreen and WinForms implementations with #if def's
to allow for the partial class to be used between the three implementations.


File: CefSharp/ModelBinding/Readme.md

TODO:

  • Move these classes into the JavascriptBinding namespace
    things are spead out currently and they should be consolidated.

File: README.WPF.md

README (WPF)

This file provides some basic information about how to use the CefSharp.Wpf NuGet package.

CefSharp is based on CEF (Chromium Embeddable Framework), which is composed of a number of .dll and .pak files. For this reason, it's not enough to just add .NET reference to the CefSharp.Wpf and the CefSharp assemblies; the other .dll/.pak files must also exist in your projects "Output path" (as defined in the Visual Studio project properties.

This is done automatically by the CefSharp.Wpf NuGet package (or the packages it depend on). However, it is only possible to copy these files into either the Debug or Release target of your project. Because it is the default when creating a new project, and the target which is normally used when developing .NET applications, I have chosen to place them in the bin\Debug folder for now. This means that if you want to run your application in Release mode, you need to copy these files from bin\Debug to bin\Release for the moment.

To be able to use CefSharp.Wpf, you basically just have to add a ChromiumWebBrowser like this:

xml
<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" Title="MainWindow" Height="350" Width="525">
    <Grid>
        <cefSharp:ChromiumWebBrowser x:Name="Browser" Address="http://www.google.com.au" />
    </Grid>
</Window>

...and in the code-behind some code like this:

csharp
public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            Cef.Initialize(new CefSettings());
        }
    }