mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
Page:
Quick Start For MS .Net 4.x
Pages
Advanced Async JavaScript Binding (JSB)
Building CefSharp
Building Nupkg Files
CPP .Net References
CefSharp 43
CefSharp中文帮助文档
Cefsharp references
ChangeLog
Chromium General Info
Creating user tabs or popup windows in Winforms
Embedding PDF.JS in CEFSharp
Forking and Pull Requests
Frequently asked questions
General Usage
Getting Started
Home
JavaScript Binding API
Output files description table (Redistribution)
Questions & Support
Quick Start For MS .Net 4.x
Quick Start For MS .Net 5.0 or greater
Quick Start
SelfHost BrowserSubProcess
Todo Ideas Feature Requests
Trouble Shooting
Upgrading from CefSharp 1
Versions
Windows XP No Longer Supported
suggestions ui
Clone
6
Quick Start For MS .Net 4.x
Alex Maitland edited this page 2023-08-03 05:44:15 +10:00
For those targeting MS .Net 4.6.x, .Net 4.7.x and .Net 4.8
Starting in M115 .Net 4.6.2 is the minimum supported version.
1.0 Install Nuget Packages
Install one of the following via the Nuget Package Manager from within Visual Studio
2.0 AnyCPU (Optional)
- When targeting
AnyCPUwithPrefer32bit = truethen no further action is required. Your application is32bitand will include the32bitbinaries/resources. - When targeting
AnyCPUplease see https://github.com/cefsharp/CefSharp/issues/1714. TheMinimalExampledemosAnyCPUsupport and can be used as a reference.
3.0 Read the Docs
- Review the Post Installation steps in the
Readme.txtfile that's opened inVisual Studioupon installation. - Review the Release Notes for the version you just installed, a list of
Known Issuesfor the problems we're currently aware of. - Check out the API Doc, it's version specific, make sure you pick the correct version.
4.0 Add app.manifest to your application
Add an app.manifest to your exe if you don't already have one, it's required for Windows 10/11 compatibility, GPU Acceleration, HighDPI support and tooltips. See https://learn.microsoft.com/en-us/windows/win32/w8cookbook/windows-version-check#declaring-windows-10-compatibility-with-an-app-manifest
<!-- example.exe.manifest -->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity
type="win32"
name="Contoso.ExampleApplication.ExampleBinary"
version="1.2.3.4"
processorArchitecture="x86"
/>
<description>Contoso Example Application</description>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10/11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> <!-- * ADD THIS LINE * -->
</application>
</compatibility>
</assembly>
The https://github.com/cefsharp/CefSharp.MinimalExample project contains an example app.manifest file in the root of the WPF/WinForms/OffScreen examples.
5.0 Add ChromiumWebBrowser to your application.
| Implementation | Example |
| WPF |
For WPF use CefSharp.Wpf.ChromiumWebBrowser
|
| WinForms |
For WinForms use CefSharp.WinForms.ChromiumWebBrowser
|
| OffScreen |
For OffScreen use CefSharp.OffScreen.ChromiumWebBrowser
|
5.1 Execute some JavaScript (optional)
// 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;
}
Anyone with a GitHub account can edit this wiki, contributions are encouraged and welcomed.