Net Core - Support for compiling with .Net Core 3.1

- Make Wpf/WinForms/OffScreen projects target AnyCPU
Only the VC++ projects are platform specific now.
- Remove BrowserSubProcess project reference
Not needed as we now have a standalone exe
- Add OffScreen example
- Add WPF Example project
- Fix some compile errors for main solution
- Add BrowserSubProcess executable
- JavascriptObjectRepository remove isAsync param
Rather than throw exception remove the option
- BrowserSubprocess Exclude the WCF specific code from the netCore project
- Add some ifdef/ifndef to exclude the WCF specific implementation
- Move WCF implementation into separate namespace
This commit is contained in:
amaitland
2020-07-18 13:30:54 +10:00
parent a0d90788aa
commit e8cf336bf3
42 changed files with 420 additions and 181 deletions
@@ -65,10 +65,12 @@ namespace CefSharp.WinForms.Example
browser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
browser.LoadError += OnLoadError;
#if !NETCOREAPP
#if NETCOREAPP
browser.JavascriptObjectRepository.Register("boundAsync", new AsyncBoundObject(), options: BindingOptions.DefaultBinder);
#else
browser.JavascriptObjectRepository.Register("bound", new BoundObject(), isAsync: false, options: BindingOptions.DefaultBinder);
#endif
browser.JavascriptObjectRepository.Register("boundAsync", new AsyncBoundObject(), isAsync: true, options: BindingOptions.DefaultBinder);
#endif
//If you call CefSharp.BindObjectAsync in javascript and pass in the name of an object which is not yet
//bound, then ResolveObject will be called, you can then register it
@@ -77,7 +79,11 @@ namespace CefSharp.WinForms.Example
var repo = e.ObjectRepository;
if (e.ObjectName == "boundAsync2")
{
#if NETCOREAPP
repo.Register("boundAsync2", new AsyncBoundObject(), options: BindingOptions.DefaultBinder);
#else
repo.Register("boundAsync2", new AsyncBoundObject(), isAsync: true, options: BindingOptions.DefaultBinder);
#endif
}
};
@@ -1,53 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- Note: We cannot use the recommended style of specifying <Project Sdk=...> because we need
<!-- 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.netcore\</BaseIntermediateOutputPath>
<BaseOutputPath>bin.netcore\</BaseOutputPath>
</PropertyGroup>
<PropertyGroup>
<BaseIntermediateOutputPath>obj.netcore\</BaseIntermediateOutputPath>
<BaseOutputPath>bin.netcore\</BaseOutputPath>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>CefSharp.WinForms.Example</RootNamespace>
<AssemblyName>CefSharp.WinForms.Example</AssemblyName>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationManifest>app.manifest</ApplicationManifest>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Platforms>x86;x64</Platforms>
</PropertyGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>CefSharp.WinForms.Example</RootNamespace>
<AssemblyName>CefSharp.WinForms.Example</AssemblyName>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationManifest>app.manifest</ApplicationManifest>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Platforms>x86;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\CefSharp.BrowserSubprocess.Core\CefSharp.BrowserSubprocess.Core.netcore.vcxproj" />
<ProjectReference Include="..\CefSharp.Core\CefSharp.Core.netcore.vcxproj" />
<ProjectReference Include="..\CefSharp.Example\CefSharp.Example.netcore.csproj" />
<ProjectReference Include="..\CefSharp.WinForms\CefSharp.WinForms.netcore.csproj" />
<ProjectReference Include="..\CefSharp\CefSharp.netcore.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CefSharp.Core\CefSharp.Core.netcore.vcxproj" />
<ProjectReference Include="..\CefSharp.Example\CefSharp.Example.netcore.csproj" />
<ProjectReference Include="..\CefSharp.WinForms\CefSharp.WinForms.netcore.csproj" />
<ProjectReference Include="..\CefSharp\CefSharp.netcore.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="crash_reporter.cfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<!-- Don't include items from the "bin" and "obj" folders used by the .NET Framework projects. -->
<None Remove="bin/**/*.*" />
<None Remove="obj/**/*.*" />
<Compile Remove="obj/**/*.*" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="crash_reporter.cfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<!-- Don't include items from the "bin" and "obj" folders used by the .NET Framework projects. -->
<None Remove="bin/**/*.*" />
<None Remove="obj/**/*.*" />
<Compile Remove="obj/**/*.*" />
</ItemGroup>
<Import Project="$(SolutionDir)\CefSharp.Native.props" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.WindowsDesktop" />
</Project>
-12
View File
@@ -50,18 +50,6 @@ namespace CefSharp.WinForms.Example
}
else
{
#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
#if DEBUG
if (!System.Diagnostics.Debugger.IsAttached)
{