-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Quick Start For MS .Net 4.x
Alex Maitland edited this page Sep 27, 2022
·
6 revisions
For those targeting MS .Net 4.5.2, .Net 4.6.x, .Net 4.7.x and .Net 4.8
Install one of the following via the Nuget Package Manager
from within Visual Studio
- When targeting
AnyCPU
withPrefer32bit = true
then no further action is required. Your application is32bit
and will include the32bit
binaries/resources. - When targeting
AnyCPU
please see https://github.com/cefsharp/CefSharp/issues/1714. TheMinimalExample
demosAnyCPU
support and can be used as a reference.
- Review the Post Installation steps in the
Readme.txt
file that's opened inVisual 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.
Implementation | Example |
WPF |
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> |
WinForms |
For WinForms use CefSharp.WinForms.ChromiumWebBrowser
using CefSharp;
using CefSharp.WinForms;
//Create a new instance in code or add via the designer
var browser = new ChromiumWebBrowser("www.google.com");
parent.Controls.Add(browser);
//Load a different url
browser.LoadUrl("https://github.com"); |
OffScreen |
For OffScreen use CefSharp.OffScreen.ChromiumWebBrowser
using CefSharp;
using CefSharp.OffScreen;
//Create a new instance in code
var browser = new ChromiumWebBrowser("www.google.com");
//Load a different url
browser.LoadUrl("https://github.com"); |
// Add usage statement to access additional functionality
// e.g. EvaluateScriptAsync
using CefSharp;
var response = await browser.EvaluateScriptAsync("1 + 1");
if(response.Success)
{
var result = response.Result;
}