Skip to content

Commit 4272e5b

Browse files
committed
BrowserProcess - Target only Net 472
- To simplify build and deployment target only .Net 4.7.2 .Net 4.7.2 is installed on Windows 10 1803. This only changes the BrowserProcess, it's possible to host the browser in .net 4.6.2+, .net core 3.1, .net 5/6/7
1 parent da6d3dd commit 4272e5b

4 files changed

Lines changed: 5 additions & 33 deletions

File tree

CefSharp.OutOfProcess.BrowserProcess/CefSharp.OutOfProcess.BrowserProcess.csproj

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,21 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
5+
<TargetFramework>net472</TargetFramework>
66
<PlatformTarget>x64</PlatformTarget>
7-
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
8-
<SelfContained>false</SelfContained>
97
<ApplicationManifest>app.manifest</ApplicationManifest>
10-
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
118
<LangVersion>Latest</LangVersion>
9+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1210
<!--<CefSharpBuildAction>NoAction</CefSharpBuildAction>-->
1311
</PropertyGroup>
1412

1513
<ItemGroup>
1614
<PackageReference Include="PInvoke.Kernel32" Version="0.7.104" />
1715
<PackageReference Include="PInvoke.User32" Version="0.7.104" />
1816
<PackageReference Include="StreamJsonRpc" Version="2.11.35" />
19-
</ItemGroup>
20-
21-
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
2217
<PackageReference Include="CefSharp.Common" Version="110.0.250" />
2318
</ItemGroup>
2419

25-
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
26-
<PackageReference Include="CefSharp.Common.NETCore" Version="110.0.250" />
27-
</ItemGroup>
28-
2920
<ItemGroup>
3021
<ProjectReference Include="..\CefSharp.OutOfProcess.Interface\CefSharp.OutOfProcess.Interface.csproj" />
3122
</ItemGroup>

CefSharp.OutOfProcess.WinForms.Example/BrowserForm.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.ComponentModel;
77
using System.Diagnostics;
88
using System.IO;
9-
using System.Reflection.Metadata;
109
using System.Runtime.InteropServices;
1110
using System.Windows.Forms;
1211

@@ -20,12 +19,6 @@ public partial class BrowserForm : Form
2019
private string _buildType = "Release";
2120
#endif
2221

23-
#if NETCOREAPP3_1_OR_GREATER
24-
private string _targetFramework = "netcoreapp3.1";
25-
#else
26-
private string _targetFramework = "net462";
27-
#endif
28-
2922
private const string DefaultUrlForAddedTabs = "https://www.google.com";
3023
private OutOfProcessHost _outOfProcessHost;
3124

@@ -59,7 +52,7 @@ public IContainer Components
5952

6053
private async void BrowserFormLoad(object sender, EventArgs e)
6154
{
62-
var outOfProcessHostPath = Path.GetFullPath($"..\\..\\..\\..\\..\\CefSharp.OutOfProcess.BrowserProcess\\bin\\{_buildType}\\{_targetFramework}");
55+
var outOfProcessHostPath = Path.GetFullPath($"..\\..\\..\\..\\..\\CefSharp.OutOfProcess.BrowserProcess\\bin\\{_buildType}");
6356
outOfProcessHostPath = Path.Combine(outOfProcessHostPath, OutOfProcessHost.HostExeName);
6457
var cachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\OutOfProcessCache");
6558
_outOfProcessHost = await OutOfProcessHost.CreateAsync(outOfProcessHostPath, cachePath);

CefSharp.OutOfProcess.WinForms.Example/Minimal/HostForm.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ public partial class HostForm : Form
1111
#else
1212
private string _buildType = "Release";
1313
#endif
14-
15-
#if NETCOREAPP3_1_OR_GREATER
16-
private string _targetFramework = "netcoreapp3.1";
17-
#else
18-
private string _targetFramework = "net462";
19-
#endif
2014
private OutOfProcessHost _outOfProcessHost;
2115

2216
public HostForm()
@@ -36,7 +30,7 @@ private void HostFormOResize(object sender, EventArgs e)
3630

3731
private async void HostFormOnLoad(object sender, EventArgs e)
3832
{
39-
var outOfProcessHostPath = Path.GetFullPath($"..\\..\\..\\..\\..\\CefSharp.OutOfProcess.BrowserProcess\\bin\\{_buildType}\\{_targetFramework}");
33+
var outOfProcessHostPath = Path.GetFullPath($"..\\..\\..\\..\\..\\CefSharp.OutOfProcess.BrowserProcess\\bin\\{_buildType}");
4034
outOfProcessHostPath = Path.Combine(outOfProcessHostPath, OutOfProcessHost.HostExeName);
4135
_outOfProcessHost = await OutOfProcessHost.CreateAsync(outOfProcessHostPath);
4236

CefSharp.OutOfProcess.Wpf.HwndHost.Example/MainWindow.xaml.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ public partial class MainWindow : Window
1515
private string _buildType = "Release";
1616
#endif
1717

18-
#if NETCOREAPP3_1_OR_GREATER
19-
private string _targetFramework = "netcoreapp3.1";
20-
#else
21-
private string _targetFramework = "net462";
22-
#endif
23-
2418
private OutOfProcessHost _outOfProcessHost;
2519

2620
public MainWindow()
@@ -32,7 +26,7 @@ public MainWindow()
3226

3327
private async void OnMainWindowLoaded(object sender, RoutedEventArgs e)
3428
{
35-
var outOfProcessHostPath = Path.GetFullPath($"..\\..\\..\\..\\CefSharp.OutOfProcess.BrowserProcess\\bin\\{_buildType}\\{_targetFramework}");
29+
var outOfProcessHostPath = Path.GetFullPath($"..\\..\\..\\..\\CefSharp.OutOfProcess.BrowserProcess\\bin\\{_buildType}");
3630
outOfProcessHostPath = Path.Combine(outOfProcessHostPath, OutOfProcessHost.HostExeName);
3731
var cachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\OutOfProcessCache");
3832
_outOfProcessHost = await OutOfProcessHost.CreateAsync(outOfProcessHostPath, cachePath);

0 commit comments

Comments
 (0)