Upgrade to 87.1.132 (#130)

* Upgrade to 87.1.12-CI3846

- Upgrade to Net Core 3.1 (Required to use new Net Core packages)
- Migrate to NetCore specific pages

* Upgrade to 87.1.130-pre

* OffScreen - Remove UseWindowsForms from csproj file

No longer required as we use the Drawing nuget package
Also causes a problem with Console.ReadLine

* README.md - Update Net Core Section

* WinForms - Add new SdkStyle .Net 4.7.2 project and solution

TODO: Add OffScreen and WPF project files

* Upgrade to 87.1.131-pre

* Upgrade to 87.1.132
This commit is contained in:
Alex Maitland 2021-02-03 12:06:58 +11:00 committed by GitHub
parent 6b92ff6dd0
commit 95f428829b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 176 additions and 298 deletions

2
.gitignore vendored
View File

@ -3,6 +3,8 @@
[Oo]bj/
[Bb]in.netcore/
[Oo]bj.netcore/
[Bb]in.net472/
[Oo]bj.net472/
# mstest test results
TestResults

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\CefSharp.OffScreen.86.0.241\build\CefSharp.OffScreen.props" Condition="Exists('..\packages\CefSharp.OffScreen.86.0.241\build\CefSharp.OffScreen.props')" />
<Import Project="..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.props')" />
<Import Project="..\packages\cef.redist.x86.86.0.24\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.86.0.24\build\cef.redist.x86.props')" />
<Import Project="..\packages\cef.redist.x64.86.0.24\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.86.0.24\build\cef.redist.x64.props')" />
<Import Project="..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.props')" />
<Import Project="..\packages\cef.redist.x86.87.1.13\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.87.1.13\build\cef.redist.x86.props')" />
<Import Project="..\packages\cef.redist.x64.87.1.13\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.87.1.13\build\cef.redist.x64.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -65,6 +64,18 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="CefSharp, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CefSharp.Core, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CefSharp.OffScreen, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.OffScreen.87.1.132\lib\net452\CefSharp.OffScreen.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
@ -83,6 +94,5 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.targets')" />
<Import Project="..\packages\CefSharp.OffScreen.86.0.241\build\CefSharp.OffScreen.targets" Condition="Exists('..\packages\CefSharp.OffScreen.86.0.241\build\CefSharp.OffScreen.targets')" />
<Import Project="..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.targets')" />
</Project>

View File

@ -11,8 +11,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>CefSharp.MinimalExample.OffScreen</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
@ -29,44 +28,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CefSharp.OffScreen" Version="86.0.241" />
<PackageReference Include="CefSharp.OffScreen.NetCore" Version="87.1.132" />
</ItemGroup>
<ItemGroup>
<!-- TODO: These updates are currently required because CefSharp.OffScreen specifies
<Private>false</Private>, which means these libraries will not be specified in
the .deps.json file, and so the CoreCLR wouldn't load these. -->
<Reference Update="CefSharp">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Core">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.OffScreen">
<Private>true</Private>
</Reference>
</ItemGroup>
<!-- Include CefSharp.BrowserSubprocess.Core so we can selfhost the BrowserSubProcess using our exe -->
<Choose>
<When Condition="'$(PlatformTarget)' == 'x64'">
<ItemGroup>
<Reference Include="CefSharp.BrowserSubprocess.Core">
<HintPath>$(CefSharpBrowserProcessCore64)</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</When>
<!-- x86, Win32 and AnyCPU -->
<Otherwise>
<ItemGroup>
<Reference Include="CefSharp.BrowserSubprocess.Core">
<HintPath>$(CefSharpBrowserProcessCore32)</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
</Project>

View File

@ -23,36 +23,21 @@ namespace CefSharp.MinimalExample.OffScreen
Console.WriteLine("You may see Chromium debugging output, please wait...");
Console.WriteLine();
#if NETCOREAPP
//We are using our current exe as the BrowserSubProcess
//Multiple instances will be spawned to handle all the
//Chromium proceses, render, gpu, network, plugin, etc.
var subProcessExe = new CefSharp.BrowserSubprocess.BrowserSubprocessExecutable();
var result = subProcessExe.Main(args);
if (result > 0)
{
return result;
}
#endif
var settings = new CefSettings()
{
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache")
};
var dependencyCheck = true;
#if NETCOREAPP
//We use our Applications exe as the BrowserSubProcess, multiple copies
//will be spawned
//TODO: The OffScreen implementation is crashing on Exit (WPF/WinForms are working fine).
//So for now this is commented out and the old .Net CefSharp.BrowserSubProcess.exe
//is used.
//var exePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
//settings.BrowserSubprocessPath = exePath;
//This should be fixed shortly.
dependencyCheck = false;
#endif
//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
Cef.Initialize(settings, performDependencyCheck: dependencyCheck, browserProcessHandler: null);
// Create the offscreen Chromium browser.
browser = new ChromiumWebBrowser(testUrl);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="86.0.24" targetFramework="net452" />
<package id="cef.redist.x86" version="86.0.24" targetFramework="net452" />
<package id="CefSharp.Common" version="86.0.241" targetFramework="net452" />
<package id="CefSharp.OffScreen" version="86.0.241" targetFramework="net452" />
<package id="cef.redist.x64" version="87.1.13" targetFramework="net452" />
<package id="cef.redist.x86" version="87.1.13" targetFramework="net452" />
<package id="CefSharp.Common" version="87.1.132" targetFramework="net452" />
<package id="CefSharp.OffScreen" version="87.1.132" targetFramework="net452" />
</packages>

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\CefSharp.WinForms.86.0.241\build\CefSharp.WinForms.props" Condition="Exists('..\packages\CefSharp.WinForms.86.0.241\build\CefSharp.WinForms.props')" />
<Import Project="..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.props')" />
<Import Project="..\packages\cef.redist.x86.86.0.24\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.86.0.24\build\cef.redist.x86.props')" />
<Import Project="..\packages\cef.redist.x64.86.0.24\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.86.0.24\build\cef.redist.x64.props')" />
<Import Project="..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.props')" />
<Import Project="..\packages\cef.redist.x86.87.1.13\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.87.1.13\build\cef.redist.x86.props')" />
<Import Project="..\packages\cef.redist.x64.87.1.13\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.87.1.13\build\cef.redist.x64.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -56,6 +55,18 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="CefSharp, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CefSharp.Core, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CefSharp.WinForms, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.WinForms.87.1.132\lib\net452\CefSharp.WinForms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -113,6 +124,5 @@
<None Include="Resources\chromium-256.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.targets')" />
<Import Project="..\packages\CefSharp.WinForms.86.0.241\build\CefSharp.WinForms.targets" Condition="Exists('..\packages\CefSharp.WinForms.86.0.241\build\CefSharp.WinForms.targets')" />
<Import Project="..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.targets')" />
</Project>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- Note: We cannot use the recommended style of specifying <Project Sdk=...> because we need
to set BaseIntermediateOutputPath and BaseOutputPath before the SDK props are imported. -->
<PropertyGroup>
<BaseIntermediateOutputPath>obj.net472\</BaseIntermediateOutputPath>
<BaseOutputPath>bin.net472\</BaseOutputPath>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net472</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>CefSharp.MinimalExample.WinForms</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>x86;x64</Platforms>
<ProjectGuid>{1D1D63D1-5257-4AA0-A284-7EF4574878CB}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Compile Remove="bin\**" />
<Compile Remove="obj\**" />
<EmbeddedResource Remove="bin\**" />
<EmbeddedResource Remove="obj\**" />
<None Remove="bin\**" />
<None Remove="obj\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CefSharp.WinForms" Version="87.1.132" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
</Project>

View File

@ -11,7 +11,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>CefSharp.MinimalExample.WinForms</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
@ -29,44 +29,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CefSharp.WinForms" Version="86.0.241" />
<PackageReference Include="CefSharp.WinForms.NetCore" Version="87.1.132" />
</ItemGroup>
<ItemGroup>
<!-- TODO: These updates are currently required because CefSharp.WinForms specifies
<Private>false</Private>, which means these libraries will not be specified in
the .deps.json file, and so the CoreCLR wouldn't load these. -->
<Reference Update="CefSharp">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Core">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.WinForms">
<Private>true</Private>
</Reference>
</ItemGroup>
<!-- Include CefSharp.BrowserSubprocess.Core so we can selfhost the BrowserSubProcess using our exe -->
<Choose>
<When Condition="'$(PlatformTarget)' == 'x64'">
<ItemGroup>
<Reference Include="CefSharp.BrowserSubprocess.Core">
<HintPath>$(CefSharpBrowserProcessCore64)</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</When>
<!-- x86, Win32 and AnyCPU -->
<Otherwise>
<ItemGroup>
<Reference Include="CefSharp.BrowserSubprocess.Core">
<HintPath>$(CefSharpBrowserProcessCore32)</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
</Project>

View File

@ -17,31 +17,12 @@ namespace CefSharp.MinimalExample.WinForms
//For Windows 7 and above, best to include relevant app.manifest entries as well
Cef.EnableHighDPISupport();
#if NETCOREAPP
//We are using our current exe as the BrowserSubProcess
//Multiple instances will be spawned to handle all the
//Chromium proceses, render, gpu, network, plugin, etc.
var subProcessExe = new CefSharp.BrowserSubprocess.BrowserSubprocessExecutable();
var result = subProcessExe.Main(args);
if (result > 0)
{
return result;
}
#endif
var settings = new CefSettings()
{
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache")
};
#if NETCOREAPP
//We use our Applications exe as the BrowserSubProcess, multiple copies
//will be spawned
var exePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
settings.BrowserSubprocessPath = exePath;
#endif
//Example of setting a command line argument
//Enables WebRTC
// - CEF Doesn't currently support permissions on a per browser basis see https://bitbucket.org/chromiumembedded/cef/issues/2582/allow-run-time-handling-of-media-access
@ -54,9 +35,15 @@ namespace CefSharp.MinimalExample.WinForms
//For screen sharing add (see https://bitbucket.org/chromiumembedded/cef/issues/2582/allow-run-time-handling-of-media-access#comment-58677180)
settings.CefCommandLineArgs.Add("enable-usermedia-screen-capturing");
var dependencyCheck = true;
#if NETCOREAPP
//This should be fixed shortly.
dependencyCheck = false;
#endif
//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
Cef.Initialize(settings, performDependencyCheck: dependencyCheck, browserProcessHandler: null);
var browser = new BrowserForm();
Application.Run(browser);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="86.0.24" targetFramework="net452" />
<package id="cef.redist.x86" version="86.0.24" targetFramework="net452" />
<package id="CefSharp.Common" version="86.0.241" targetFramework="net452" />
<package id="CefSharp.WinForms" version="86.0.241" targetFramework="net452" />
<package id="cef.redist.x64" version="87.1.13" targetFramework="net452" />
<package id="cef.redist.x86" version="87.1.13" targetFramework="net452" />
<package id="CefSharp.Common" version="87.1.132" targetFramework="net452" />
<package id="CefSharp.WinForms" version="87.1.132" targetFramework="net452" />
</packages>

View File

@ -9,7 +9,6 @@ namespace CefSharp.MinimalExample.Wpf
{
public App()
{
#if !NETCOREAPP
var settings = new CefSettings()
{
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
@ -28,9 +27,15 @@ namespace CefSharp.MinimalExample.Wpf
//For screen sharing add (see https://bitbucket.org/chromiumembedded/cef/issues/2582/allow-run-time-handling-of-media-access#comment-58677180)
settings.CefCommandLineArgs.Add("enable-usermedia-screen-capturing");
//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
var dependencyCheck = true;
#if NETCOREAPP
//This should be fixed shortly.
dependencyCheck = false;
#endif
//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(settings, performDependencyCheck: dependencyCheck, browserProcessHandler: null);
}
}
}

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\CefSharp.Wpf.86.0.241\build\CefSharp.Wpf.props" Condition="Exists('..\packages\CefSharp.Wpf.86.0.241\build\CefSharp.Wpf.props')" />
<Import Project="..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.props')" />
<Import Project="..\packages\cef.redist.x86.86.0.24\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.86.0.24\build\cef.redist.x86.props')" />
<Import Project="..\packages\cef.redist.x64.86.0.24\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.86.0.24\build\cef.redist.x64.props')" />
<Import Project="..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.props')" />
<Import Project="..\packages\cef.redist.x86.87.1.13\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.87.1.13\build\cef.redist.x86.props')" />
<Import Project="..\packages\cef.redist.x64.87.1.13\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.87.1.13\build\cef.redist.x64.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -70,6 +69,18 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="CefSharp, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CefSharp.Core, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.Common.87.1.132\lib\net452\CefSharp.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CefSharp.Wpf, Version=87.1.132.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138">
<HintPath>..\packages\CefSharp.Wpf.87.1.132\lib\net452\CefSharp.Wpf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.19\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
@ -143,8 +154,7 @@
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.86.0.241\build\CefSharp.Common.targets')" />
<Import Project="..\packages\CefSharp.Wpf.86.0.241\build\CefSharp.Wpf.targets" Condition="Exists('..\packages\CefSharp.Wpf.86.0.241\build\CefSharp.Wpf.targets')" />
<Import Project="..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.87.1.132\build\CefSharp.Common.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -11,14 +11,13 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<RootNamespace>CefSharp.MinimalExample.Wpf</RootNamespace>
<ApplicationIcon>chromium-256.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>x86;x64</Platforms>
<StartupObject>CefSharp.MinimalExample.Wpf.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
@ -33,45 +32,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CefSharp.Wpf" Version="86.0.241" />
<PackageReference Include="CefSharp.Wpf.NetCore" Version="87.1.132" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
</ItemGroup>
<ItemGroup>
<!-- TODO: These updates are currently required because CefSharp.Wpf specifies
<Private>false</Private>, which means these libraries will not be specified in
the .deps.json file, and so the CoreCLR wouldn't load these. -->
<Reference Update="CefSharp">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Core">
<Private>true</Private>
</Reference>
<Reference Update="CefSharp.Wpf">
<Private>true</Private>
</Reference>
</ItemGroup>
<!-- Include CefSharp.BrowserSubprocess.Core so we can selfhost the BrowserSubProcess using our exe -->
<Choose>
<When Condition="'$(PlatformTarget)' == 'x64'">
<ItemGroup>
<Reference Include="CefSharp.BrowserSubprocess.Core">
<HintPath>$(CefSharpBrowserProcessCore64)</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</When>
<!-- x86, Win32 and AnyCPU -->
<Otherwise>
<ItemGroup>
<Reference Include="CefSharp.BrowserSubprocess.Core">
<HintPath>$(CefSharpBrowserProcessCore32)</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
</Project>

View File

@ -1,50 +0,0 @@
using CefSharp.Wpf;
using System;
using System.IO;
namespace CefSharp.MinimalExample.Wpf
{
public static class Program
{
/// <summary>
/// Application Entry Point.
/// </summary>
[STAThread]
public static int Main(string[] args)
{
//For Windows 7 and above, app.manifest entries will take precedences of this call
Cef.EnableHighDPISupport();
//We are using our current exe as the BrowserSubProcess
//Multiple instances will be spawned to handle all the
//Chromium proceses, render, gpu, network, plugin, etc.
var subProcessExe = new CefSharp.BrowserSubprocess.BrowserSubprocessExecutable();
var result = subProcessExe.Main(args);
if (result > 0)
{
return result;
}
//We use our current exe as the BrowserSubProcess
var exePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
var settings = new CefSettings()
{
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"),
BrowserSubprocessPath = exePath
};
//Example of setting a command line argument
//Enables WebRTC
settings.CefCommandLineArgs.Add("enable-media-stream");
//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
var app = new App();
app.InitializeComponent();
return app.Run();
}
}
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="86.0.24" targetFramework="net452" />
<package id="cef.redist.x86" version="86.0.24" targetFramework="net452" />
<package id="CefSharp.Common" version="86.0.241" targetFramework="net452" />
<package id="CefSharp.Wpf" version="86.0.241" targetFramework="net452" />
<package id="cef.redist.x64" version="87.1.13" targetFramework="net452" />
<package id="cef.redist.x86" version="87.1.13" targetFramework="net452" />
<package id="CefSharp.Common" version="87.1.132" targetFramework="net452" />
<package id="CefSharp.Wpf" version="87.1.132" targetFramework="net452" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.19" targetFramework="net452" />
</packages>

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CefSharp.MinimalExample.WinForms.net472", "CefSharp.MinimalExample.WinForms\CefSharp.MinimalExample.WinForms.net472.csproj", "{1D1D63D1-5257-4AA0-A284-7EF4574878CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Debug|x64.ActiveCfg = Debug|x64
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Debug|x64.Build.0 = Debug|x64
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Debug|x86.ActiveCfg = Debug|x86
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Debug|x86.Build.0 = Debug|x86
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Release|x64.ActiveCfg = Release|x64
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Release|x64.Build.0 = Release|x64
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Release|x86.ActiveCfg = Release|x86
{1D1D63D1-5257-4AA0-A284-7EF4574878CB}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {112012F9-E248-466E-BC28-B36C15B0C4BF}
EndGlobalSection
EndGlobal

View File

@ -12,63 +12,20 @@ Includes examples for
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](https://github.com/cefsharp/CefSharp/wiki/General-Usage#processes) launches multiple BrowserSubProcess instances for rendering, gpu acceleration, networking, plugins, etc.
- By default `CefSharp` provides a default BrowserSubProcess (`CefSharp.BrowserSubprocess.exe`) which requires the .NET Framework 4.5.2 or higher installed.
- It is possible to `self host` the BrowserSubProcess using your application exe this example was updated to demonstrate this in commit https://github.com/cefsharp/CefSharp.MinimalExample/commit/898eb755c6bb7f504f9b5bdc889ff9142e105848
- A new `.Net Core` BrowserSubProcess is in the works at https://github.com/cefsharp/CefSharp.BrowserSubProcess.NetCore
- Additional entires to your csproj/vbproj are required for the CoreCLR to load the `CefSharp.*` libraries (They would not be specified in the `.deps.json` file 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-x64` or `win-x86`, you need to set the `Platform` property to `x64` or `x86`; as otherwise it would be `AnyCPU` and the check in the `.targets` file of the NuGet package would fail.<br>
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`
The first `-pre` set of `NETCore/Net 5` packages are now on Nuget.org
- https://www.nuget.org/packages/CefSharp.WinForms.NETCore/87.1.130-pre
- https://www.nuget.org/packages/CefSharp.Wpf.NETCore/87.1.130-pre
- https://www.nuget.org/packages/CefSharp.OffScreen.NETCore/87.1.130-pre
- Publish Example
- x86: `dotnet publish -f netcoreapp3.1 -r win-x86
- x64: `dotnet publish -f netcoreapp3.1 -r win-x64
It is possible to publish the application as single EXE file by adding `-p:PublishSingleFile=true`.
### .Net Core csproj/vbproj WPF
```xml
<!-- 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>
```
Any problems please report them on https://github.com/cefsharp/CefSharp/issues/3197
### .Net Core csproj/vbproj WinForms
```xml
<!-- 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 5 Support
The same packages listed above in the .Net Core section should be used for .Net 5.0
### .Net Core csproj/vbproj OffScreen
```xml
<!-- 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>
```

View File

@ -1,4 +1,4 @@
SET cefsharpversion=86.0.241
SET cefsharpversion=87.1.132
..\nuget restore CefSharp.MinimalExample.sln
@ -6,8 +6,12 @@ SET cefsharpversion=86.0.241
..\nuget update CefSharp.MinimalExample.WinForms\CefSharp.MinimalExample.WinForms.csproj -Id CefSharp.WinForms -Version %cefsharpversion%
..\nuget update CefSharp.MinimalExample.Wpf\CefSharp.MinimalExample.Wpf.csproj -Id CefSharp.Wpf -Version %cefsharpversion%
dotnet add CefSharp.MinimalExample.OffScreen\CefSharp.MinimalExample.OffScreen.netcore.csproj package CefSharp.OffScreen -v %cefsharpversion%
dotnet add CefSharp.MinimalExample.WinForms\CefSharp.MinimalExample.WinForms.netcore.csproj package CefSharp.WinForms -v %cefsharpversion%
dotnet add CefSharp.MinimalExample.Wpf\CefSharp.MinimalExample.Wpf.netcore.csproj package CefSharp.Wpf -v %cefsharpversion%
rem #dotnet add CefSharp.MinimalExample.OffScreen\CefSharp.MinimalExample.OffScreen.netcore.csproj package CefSharp.OffScreen.NetCore -v %cefsharpversion%
dotnet add CefSharp.MinimalExample.WinForms\CefSharp.MinimalExample.WinForms.net472.csproj package CefSharp.WinForms -v %cefsharpversion%
rem dotnet add CefSharp.MinimalExample.Wpf\CefSharp.MinimalExample.Wpf.netcore.csproj package CefSharp.Wpf.NetCore -v %cefsharpversion%
dotnet add CefSharp.MinimalExample.OffScreen\CefSharp.MinimalExample.OffScreen.netcore.csproj package CefSharp.OffScreen.NetCore -v %cefsharpversion%
dotnet add CefSharp.MinimalExample.WinForms\CefSharp.MinimalExample.WinForms.netcore.csproj package CefSharp.WinForms.NetCore -v %cefsharpversion%
dotnet add CefSharp.MinimalExample.Wpf\CefSharp.MinimalExample.Wpf.netcore.csproj package CefSharp.Wpf.NetCore -v %cefsharpversion%
pause