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

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

View File

@@ -88,7 +88,11 @@ namespace CefSharp.MinimalExample.OffScreen
Console.WriteLine("Screenshot saved. Launching your default image viewer...");
// Tell Windows to launch the saved image.
Process.Start(screenshotPath);
Process.Start(new ProcessStartInfo(screenshotPath)
{
// UseShellExecute is false by default on .NET Core.
UseShellExecute = true
});
Console.WriteLine("Image viewer launched. Press any key to exit.");
}, TaskScheduler.Default);