Add .NET Core 3.0 WinForms/WPF/OffScreen examples (#57)

* Add minimal WinForms and WPF examples using .NET Core 3.0 projects, reusing the existing code files.

Issue cefsharp/CefSharp#2796

* Follow-Up: Add a minimal OffScreen example using a .NET Core 3.0 project.

* Upgrade to 75.1.142.

* Update README.md to mention .NET Core support.

* Fix typo.

* Add comment about UseShellExecute.
This commit is contained in:
Konstantin Preißer
2019-09-10 10:20:34 +02:00
committed by Alex Maitland
parent 63a8eb31cc
commit 9632e10c14
7 changed files with 176 additions and 6 deletions

View File

@@ -33,9 +33,21 @@ namespace CefSharp.MinimalExample.WinForms
browser.TitleChanged += OnBrowserTitleChanged;
browser.AddressChanged += OnBrowserAddressChanged;
var version = string.Format("Chromium: {0}, CEF: {1}, CefSharp: {2}",
Cef.ChromiumVersion, Cef.CefVersion, Cef.CefSharpVersion);
#if NETCOREAPP
// .NET Core
var environment = string.Format("Environment: {0}, Runtime: {1}",
System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(),
System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
#else
// .NET Framework
var bitness = Environment.Is64BitProcess ? "x64" : "x86";
var version = String.Format("Chromium: {0}, CEF: {1}, CefSharp: {2}, Environment: {3}", Cef.ChromiumVersion, Cef.CefVersion, Cef.CefSharpVersion, bitness);
DisplayOutput(version);
var environment = String.Format("Environment: {0}", bitness);
#endif
DisplayOutput(string.Format("{0}, {1}", version, environment));
}
private void OnIsBrowserInitializedChanged(object sender, EventArgs e)

View File

@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>CefSharp.MinimalExample.WinForms</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>x86;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CefSharp.WinForms" Version="75.1.142" />
</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>
</Project>