Skip to content

Commit dbb7189

Browse files
committed
feature: Add support for .NET Core 3.0 with WPF/Winforms
feature: Add support for .NET Core 3.0 with WPF/Winforms
1 parent 567eaab commit dbb7189

File tree

46 files changed

+230
-3346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+230
-3346
lines changed

azure-pipelines-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ pool:
1212
vmImage: vs2017-win2016
1313

1414
steps:
15+
- task: DotNetCoreInstaller@0
16+
displayName: Install .NET Core 3.0 preview
17+
inputs:
18+
version: '3.0.100-preview-009812'
19+
1520
- task: BatchScript@1
1621
inputs:
1722
filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"

azure-pipelines.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ pool:
1212
vmImage: vs2017-win2016
1313

1414
steps:
15+
- task: DotNetCoreInstaller@0
16+
displayName: Install .NET Core 3.0 preview
17+
inputs:
18+
version: '3.0.100-preview-009812'
19+
1520
- task: BatchScript@1
1621
inputs:
1722
filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"

build.cake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ var isRepository = StringComparer.OrdinalIgnoreCase.Equals("reactiveui/reactiveu
6363

6464
var vsWhereSettings = new VSWhereLatestSettings() { IncludePrerelease = includePrerelease };
6565
var vsLocation = string.IsNullOrWhiteSpace(vsLocationString) ? VSWhereLatest(vsWhereSettings) : new DirectoryPath(vsLocationString);
66-
var msBuildPath = string.IsNullOrWhiteSpace(msBuildPathString) ? vsLocation.CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe") : new FilePath(msBuildPathString);
66+
var msBuildDirectory = includePrerelease ? "./MSBuild/Current/Bin/MSBuild.exe" : "./MSBuild/15.0/Bin/MSBuild.exe";
67+
var msBuildPath = string.IsNullOrWhiteSpace(msBuildPathString) ? vsLocation.CombineWithFilePath(msBuildDirectory) : new FilePath(msBuildPathString);
6768

6869
var informationalVersion = EnvironmentVariable("GitAssemblyInformationalVersion");
6970

@@ -116,6 +117,8 @@ var packageTestWhitelist = new[]
116117
("winforms", "src/ReactiveUI.Events.Winforms/"),
117118
("essentials", "src/ReactiveUI.Events.XamEssentials/"),
118119
("tvos", "src/ReactiveUI.Events/"),
120+
("NetCoreAppWPF", "src/ReactiveUI.Events.WPF/"),
121+
("NetCoreAppWinforms", "src/ReactiveUI.Events.Winforms/"),
119122
};
120123

121124
// Define global marcos.
@@ -230,7 +233,11 @@ Task("GenerateEvents")
230233
Information("The events have been written to '{0}'", output);
231234
};
232235

233-
Parallel.ForEach(eventGenerators, arg => generate(arg.targetName, arg.destination));
236+
var options = new ParallelOptions {
237+
MaxDegreeOfParallelism = 1,
238+
};
239+
240+
Parallel.ForEach(eventGenerators, options, arg => generate(arg.targetName, arg.destination));
234241

235242
CopyFiles(GetFiles("./src/ReactiveUI.**/Events_*.cs"), Directory(eventsArtifactDirectory));
236243
});

src/EventBuilder.sln

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,59 @@ EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
11+
net_3_5_Debug_ReadOnly|Any CPU = net_3_5_Debug_ReadOnly|Any CPU
12+
net_3_5_Debug|Any CPU = net_3_5_Debug|Any CPU
13+
net_3_5_Release_ReadOnly|Any CPU = net_3_5_Release_ReadOnly|Any CPU
14+
net_3_5_Release|Any CPU = net_3_5_Release|Any CPU
15+
net_4_0_Debug_ReadOnly|Any CPU = net_4_0_Debug_ReadOnly|Any CPU
16+
net_4_0_Debug|Any CPU = net_4_0_Debug|Any CPU
17+
net_4_0_Release_ReadOnly|Any CPU = net_4_0_Release_ReadOnly|Any CPU
18+
net_4_0_Release|Any CPU = net_4_0_Release|Any CPU
19+
net_462_Debug_ReadOnly|Any CPU = net_462_Debug_ReadOnly|Any CPU
20+
net_462_Debug|Any CPU = net_462_Debug|Any CPU
21+
net_462_Release_ReadOnly|Any CPU = net_462_Release_ReadOnly|Any CPU
22+
net_462_Release|Any CPU = net_462_Release|Any CPU
23+
netstandard_Debug_ReadOnly|Any CPU = netstandard_Debug_ReadOnly|Any CPU
24+
netstandard_Debug|Any CPU = netstandard_Debug|Any CPU
25+
netstandard_Release_ReadOnly|Any CPU = netstandard_Release_ReadOnly|Any CPU
26+
netstandard_Release|Any CPU = netstandard_Release|Any CPU
1127
Release|Any CPU = Release|Any CPU
1228
EndGlobalSection
1329
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1430
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1531
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = Debug|Any CPU
33+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = Debug|Any CPU
34+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU
35+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU
36+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = Release|Any CPU
37+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = Release|Any CPU
38+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_3_5_Release|Any CPU.Build.0 = Release|Any CPU
40+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = Debug|Any CPU
41+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = Debug|Any CPU
42+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = Release|Any CPU
45+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = Release|Any CPU
46+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Release|Any CPU.ActiveCfg = Release|Any CPU
47+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_4_0_Release|Any CPU.Build.0 = Release|Any CPU
48+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = Debug|Any CPU
49+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Debug_ReadOnly|Any CPU.Build.0 = Debug|Any CPU
50+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Debug|Any CPU.ActiveCfg = Debug|Any CPU
51+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = Release|Any CPU
53+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Release_ReadOnly|Any CPU.Build.0 = Release|Any CPU
54+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.net_462_Release|Any CPU.Build.0 = Release|Any CPU
56+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = Debug|Any CPU
57+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = Debug|Any CPU
58+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Debug|Any CPU.ActiveCfg = Debug|Any CPU
59+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Debug|Any CPU.Build.0 = Debug|Any CPU
60+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = Release|Any CPU
61+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Release_ReadOnly|Any CPU.Build.0 = Release|Any CPU
62+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Release|Any CPU.ActiveCfg = Release|Any CPU
63+
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.netstandard_Release|Any CPU.Build.0 = Release|Any CPU
1664
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.Release|Any CPU.ActiveCfg = Release|Any CPU
1765
{A6B86E12-057F-4591-98A3-FD50E9CEAE69}.Release|Any CPU.Build.0 = Release|Any CPU
1866
EndGlobalSection

src/EventBuilder/AutoPlatform.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ public enum AutoPlatform
4242
/// </summary>
4343
WPF,
4444

45+
/// <summary>
46+
/// WPF for NetCoreApp 3.0 and above.
47+
/// </summary>
48+
NetCoreAppWPF,
49+
50+
/// <summary>
51+
/// WinForms for NetCoreApp 3.0 and above.
52+
/// </summary>
53+
NetCoreAppWinforms,
54+
4555
/// <summary>
4656
/// Xamarin Forms platform.
4757
/// </summary>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
2+
// Licensed to the .NET Foundation under one or more agreements.
3+
// The .NET Foundation licenses this file to you under the MIT license.
4+
// See the LICENSE file in the project root for full license information.
5+
6+
using System;
7+
using System.IO;
8+
using System.Threading.Tasks;
9+
using EventBuilder.NuGet;
10+
using NuGet.Frameworks;
11+
using NuGet.Packaging.Core;
12+
using NuGet.Versioning;
13+
using Serilog;
14+
15+
namespace EventBuilder.Platforms
16+
{
17+
/// <summary>
18+
/// Win Forms platform assemblies and events for netcoreapp3.0 and above.
19+
/// </summary>
20+
/// <seealso cref="EventBuilder.Platforms.BasePlatform" />
21+
public class NetCoreAppWinforms : BasePlatform
22+
{
23+
private readonly PackageIdentity[] _packageNames = new[]
24+
{
25+
new PackageIdentity("Microsoft.WindowsDesktop.App", new NuGetVersion("3.0.0-alpha-27128-4")),
26+
new PackageIdentity("NetStandard.Library", new NuGetVersion("2.0.0")),
27+
};
28+
29+
/// <inheritdoc />
30+
public override AutoPlatform Platform => AutoPlatform.NetCoreAppWinforms;
31+
32+
/// <inheritdoc />
33+
public async override Task Extract()
34+
{
35+
var packageUnzipPath = await NuGetPackageHelper.InstallPackages(_packageNames, Platform).ConfigureAwait(false);
36+
37+
Log.Debug($"Package unzip path is {packageUnzipPath}");
38+
39+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.dll", SearchOption.AllDirectories));
40+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.Data.dll", SearchOption.AllDirectories));
41+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.DirectoryServices.dll", SearchOption.AllDirectories));
42+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.Drawing.dll", SearchOption.AllDirectories));
43+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.Messaging.dll", SearchOption.AllDirectories));
44+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.Windows.Forms.dll", SearchOption.AllDirectories));
45+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.Windows.Forms.DataVisualization.dll", SearchOption.AllDirectories));
46+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "System.ServiceProcess.dll", SearchOption.AllDirectories));
47+
48+
foreach (var directory in Directory.GetDirectories(packageUnzipPath, "*.*", SearchOption.AllDirectories))
49+
{
50+
CecilSearchDirectories.Add(directory);
51+
}
52+
}
53+
}
54+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
2+
// Licensed to the .NET Foundation under one or more agreements.
3+
// The .NET Foundation licenses this file to you under the MIT license.
4+
// See the LICENSE file in the project root for full license information.
5+
6+
using System;
7+
using System.IO;
8+
using System.Threading.Tasks;
9+
using EventBuilder.NuGet;
10+
using NuGet.Frameworks;
11+
using NuGet.Packaging.Core;
12+
using NuGet.Versioning;
13+
using Serilog;
14+
15+
namespace EventBuilder.Platforms
16+
{
17+
/// <summary>
18+
/// WPF platform assemblies and events for netcoreapp3.0 and above.
19+
/// </summary>
20+
/// <seealso cref="EventBuilder.Platforms.BasePlatform" />
21+
public class NetCoreAppWPF : BasePlatform
22+
{
23+
private readonly PackageIdentity[] _packageNames = new[]
24+
{
25+
new PackageIdentity("Microsoft.WindowsDesktop.App", new NuGetVersion("3.0.0-alpha-27128-4")),
26+
new PackageIdentity("NetStandard.Library", new NuGetVersion("2.0.0")),
27+
};
28+
29+
/// <inheritdoc />
30+
public override AutoPlatform Platform => AutoPlatform.NetCoreAppWPF;
31+
32+
/// <inheritdoc />
33+
public async override Task Extract()
34+
{
35+
var packageUnzipPath = await NuGetPackageHelper.InstallPackages(_packageNames, Platform).ConfigureAwait(false);
36+
37+
Log.Debug($"Package unzip path is {packageUnzipPath}");
38+
39+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "WindowsBase.dll", SearchOption.AllDirectories));
40+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "PresentationCore.dll", SearchOption.AllDirectories));
41+
Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "PresentationFramework.dll", SearchOption.AllDirectories));
42+
43+
foreach (var directory in Directory.GetDirectories(packageUnzipPath, "*.*", SearchOption.AllDirectories))
44+
{
45+
CecilSearchDirectories.Add(directory);
46+
}
47+
}
48+
}
49+
}

src/EventBuilder/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ public static async Task Main(string[] args)
119119
_mustacheTemplate = "XamarinEssentialsTemplate.mustache";
120120
break;
121121

122+
case AutoPlatform.NetCoreAppWPF:
123+
platform = new NetCoreAppWPF();
124+
break;
125+
126+
case AutoPlatform.NetCoreAppWinforms:
127+
platform = new NetCoreAppWinforms();
128+
break;
129+
122130
default:
123131
throw new ArgumentException($"Platform not {options.Platform} supported");
124132
}
@@ -192,4 +200,4 @@ private static async Task ExtractEventsFromAssemblies(string outputPath, IPlatfo
192200
}
193201
}
194202
}
195-
}
203+
}
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
<Project Sdk="MSBuild.Sdk.Extras">
22
<PropertyGroup>
3-
<TargetFrameworks>net461</TargetFrameworks>
3+
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
44
<RootNamespace>ReactiveUI.Events</RootNamespace>
55
<Description>Provides Observable-based events API for WPF UI controls/eventhandlers. The contents of this package is automatically generated, please target pull-requests to the code generator.</Description>
66
<PackageId>ReactiveUI.Events.WPF</PackageId>
7-
<ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
7+
<UseWPF>true</UseWPF>
8+
<UseWindowsForms>true</UseWindowsForms>
89
<NoWarn>$(NoWarn);CS1570;CA1812</NoWarn>
910
</PropertyGroup>
1011

1112
<ItemGroup>
1213
<Compile Remove="*.cs" />
1314
<None Include="*.cs" />
1415
<Compile Include="../ReactiveUI.Events/SingleAwaitSubject.cs" />
15-
<PackageReference Include="System.Reactive" Version="4.0.0" />
16+
<PackageReference Include="System.Reactive" Version="4.2.0-preview.63" />
1617
</ItemGroup>
1718

18-
<ItemGroup>
19-
<Compile Include="Events_WPF.cs" />
19+
<ItemGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3')) ">
20+
<Compile Include="Events_NetCoreAppWPF.cs" />
21+
</ItemGroup>
22+
23+
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) ">
2024
<Reference Include="System.Xaml" />
2125
<Reference Include="PresentationCore" />
2226
<Reference Include="PresentationFramework" />
2327
<Reference Include="PresentationFramework.Aero" />
2428
<Reference Include="WindowsBase" />
29+
<Compile Include="Events_WPF.cs" />
2530
</ItemGroup>
26-
</Project>
31+
</Project>
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
<Project Sdk="MSBuild.Sdk.Extras">
22
<PropertyGroup>
3-
<TargetFrameworks>net461</TargetFrameworks>
3+
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
44
<AssemblyName>ReactiveUI.Events.Winforms</AssemblyName>
55
<RootNamespace>ReactiveUI.Events</RootNamespace>
66
<Description>Provides Observable-based events API for Winforms UI controls/eventhandlers. The contents of this package is automatically generated, please target pull-requests to the code generator.</Description>
77
<PackageId>ReactiveUI.Events.Winforms</PackageId>
8-
<ExtrasEnableWinFormsProjectSetup>true</ExtrasEnableWinFormsProjectSetup >
8+
<UseWPF>true</UseWPF>
9+
<UseWindowsForms>true</UseWindowsForms>
910
<NoWarn>$(NoWarn);CS1570;CA1812</NoWarn>
1011
</PropertyGroup>
1112

1213
<ItemGroup>
1314
<Compile Remove="*.cs" />
1415
<None Include="*.cs" />
1516
<Compile Include="../ReactiveUI.Events/SingleAwaitSubject.cs" />
16-
<PackageReference Include="System.Reactive" Version="4.0.0" />
17+
<PackageReference Include="System.Reactive" Version="4.2.0-preview.63" />
1718
</ItemGroup>
1819

19-
<ItemGroup>
20-
<Compile Include="Events_Winforms.cs" />
20+
<ItemGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3')) ">
21+
<Compile Include="Events_NetCoreAppWinforms.cs" />
22+
</ItemGroup>
23+
24+
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) ">
2125
<Reference Include="System" />
2226
<Reference Include="System.Data" />
2327
<Reference Include="System.DirectoryServices" />
@@ -26,5 +30,6 @@
2630
<Reference Include="System.Windows.Forms" />
2731
<Reference Include="System.Windows.Forms.DataVisualization" />
2832
<Reference Include="System.ServiceProcess" />
33+
<Compile Include="Events_Winforms.cs" />
2934
</ItemGroup>
30-
</Project>
35+
</Project>

0 commit comments

Comments
 (0)