CefNet is a .NET CLR binding for the Chromium Embedded Framework (CEF).
Since CefNet is a wrapper, you need to have the Chromium Embedded Framework somewhere on your development system (and redistribute it with your application).
(1) Download the Chromium Embedded Framework from: https://cef-builds.spotifycdn.com/index.html
Note: The major and minor version numbers of CEF and CefNet must match.
(2) Create an instance of the CefNetApplication and initialize it with your settings:
var settings = new CefSettings();
settings.NoSandbox = true;
settings.MultiThreadedMessageLoop = false; // or true
settings.WindowlessRenderingEnabled = true;
settings.LocalesDirPath = "path_to_cef/locales";
settings.ResourcesDirPath = "path_to_cef";
var app = new CefNetApplication();
app.Initialize("path_to_cef", settings);
(3) Add a WebView control to the form of your application.
(4) Run event loop, for example:
CefNetApplication.Run();
Note: You can use the event loop of the UI-framework you are using.
(5) You need to explicitly call CefNetApplication.Shutdown()
from the main
thread before you exit your application:
app.Shutdown();
app.Dispose();
For more information, see the sample applications.
- Cross-platform
- Full managed code
The API of this project is not frozen and is subject to change.
- Install .NET Core SDK
- Install the DotAsm tool:
dotnet tool install -g DotAsm
- Run
git clone https://github.com/CefNet/CefNet.git
- Download a CEF package. See Directory.Build.props for the required CEF version.
- Extract all files into the cef/ directory.
- Copy cef/Resources/icudtl.dat into cef/Release/.
- Download a CEF package (standard or minimal).
- Extract all header files into the cef/include directory.
- Build and run CefGen.sln in debug mode to generate the generated files. Watch the output for errors.
- Build CefNet.sln
- If the build fails, make the necessary changes.
- CefGlue: An alternative .NET CEF wrapper built using P/Invoke.
- CefSharp: Another .NET CEF wrapper built using C++/CLI.
- CEF Bitbucket Project: The official CEF issue tracker
- The official CEF Forum: http://magpcss.org/ceforum/
- CEF API Docs: http://magpcss.org/ceforum/apidocs3/index-all.html