c5da7bb06985787494c35a31b4c3bedd02f1d405
First attempt at using new UpdateNugetPackages.bat Some reason nuget update didn't correctly upgrade it added, had to manually edit the file.
CefSharp.MinimalExample
Minimal example of how the CefSharp library can be used using the official Nuget packages
- .NET Framework solution (
CefSharp.MinimalExample.sln) - .NET Core solution (
CefSharp.MinimalExample.netcore.sln).
Includes examples for
- WinForms
- WPF
- OffScreen
For a more complete example of each project see the main CefSharp repository.
.NET Core support
As of version 75.1.142, the CefSharp NuGet packages can be used with .NET Core 3.x projects (as shown by the examples). However, the current versions have some limitations that you should be aware of:
- Chromium multi-process architecure launches multiple BrowserSubProcess instances for rendering, gpu acceleration, networking, plugins, etc.
- By default
CefSharpprovides a default BrowserSubProcess (CefSharp.BrowserSubprocess.exe) which requires the .NET Framework 4.5.2 or higher installed. - It is possible to
self hostthe BrowserSubProcess using your application exe this example was updated to demonstrate this in commit898eb755c6 - A new
.Net CoreBrowserSubProcess is in the works at https://github.com/cefsharp/CefSharp.BrowserSubProcess.NetCore
- By default
- Additional entires to your csproj/vbproj are required for the CoreCLR to load the
CefSharp.*libraries (They would not be specified in the.deps.jsonfile otherwise). See example below, the netcore.csproj files contained in this example provide a working demo. - When publishing a self-contained app using a runtime identifier
win-x64orwin-x86, you need to set thePlatformproperty tox64orx86; as otherwise it would beAnyCPUand the check in the.targetsfile of the NuGet package would fail.
Example:- x86:
dotnet publish -f netcoreapp3.0 -r win-x86 -p:Platform=x86 - x64:
dotnet publish -f netcoreapp3.0 -r win-x64 -p:Platform=x64
- x86:
It is possible to publish the application as single EXE file by adding -p:PublishSingleFile=true.
.Net Core csproj/vbproj WPF
<!-- Add the following to your csproj/vbproj file -->
<ItemGroup>
<Reference Update="CefSharp">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Core">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Wpf">
<Private>true</Private>
</Reference>
</ItemGroup>
.Net Core csproj/vbproj WinForms
<!-- Add the following to your csproj/vbproj file -->
<ItemGroup>
<Reference Update="CefSharp">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Core">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.WinForms">
<Private>true</Private>
</Reference>
</ItemGroup>
.Net Core csproj/vbproj OffScreen
<!-- Add the following to your csproj/vbproj file -->
<ItemGroup>
<Reference Update="CefSharp">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Core">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.OffScreen">
<Private>true</Private>
</Reference>
</ItemGroup>
Description
Languages
C#
97.3%
Batchfile
2.7%