Skip to content
InteXX edited this page Jan 13, 2020 · 47 revisions

To get started with CefSharp checkout the CefSharp.MinimalExample project here on GitHub. The project contains basic working examples of the WinForms, WPF and OffScreen versions.

Installation

  • Install one of the following via the Nuget Package Manager from within Visual Studio
    • CefSharp.WinForms
    • CefSharp.Wpf
    • CefSharp.OffScreen
  • Review the Post Installation steps in the Readme.txt file that's opened in Visual Studio upon installation.
  • Review the Release Notes for the version you just installed, a list of Known Issues for the problems we're currently aware of.
  • Check out the API Doc, it's version specific, make sure you pick the correct version.
  • Add a new instance of the browser
    • For WPF use CefSharp.Wpf.ChromiumWebBrowser
      <!-- Add a xmlns:wpf="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" attribute to your parent control -->
      <!-- Create a new instance in code or in `xaml` -->
      <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1">
          <wpf:ChromiumWebBrowser x:Name="Browser" Address="www.google.com"/>
      </Border>
    • For WinForms use CefSharp.WinFrorms.ChromiumWebBrowser
      using CefSharp.WinForms;
      //Create a new instance in code or add via the designer
      //Set the ChromiumWebBrowser.Address property if to your Url if you use the designer.
      var browser = new ChromiumWebBrowser("www.google.com");
      parent.Controls.Add(browser);
    • For OffScreen use CefSharp.OffScreen.ChromiumWebBrowser
      using CefSharp.OffScreen;
      //Create a new instance in code
      var browser = new ChromiumWebBrowser("www.google.com");

TODO: Improve formatting, anyone with a GitHub account can help improve this wiki. Please help out!

AnyCPU Support

For details on using CefSharp and targeting AnyCPU please see https://github.com/cefsharp/CefSharp/issues/1714

The following three MinimalExample branches demo the different options

For x86 or x64 set your Solution Target architecture to x86 or x64, just changing the project target is currently not enough (See https://msdn.microsoft.com/en-us/library/ms185328.aspx#Anchor_0 for details).


Third-Party Articles

The following articles are unfortunately outdated, if you have written a new up to date article please include a link to it here.

WinForms C#

WinForms VB.Net

WPF C#

WPF VB.Net

  • Quick Start Guide (This guide is outdated, if someone has a newer one please add a link).