Skip to content

Commit caedb5e

Browse files
committed
Move to .NET 10
Move to .NET 10, xunit v3, and central package versioning
1 parent acf1873 commit caedb5e

File tree

7 files changed

+127
-49
lines changed

7 files changed

+127
-49
lines changed

.github/workflows/dotnet.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,46 @@ jobs:
1515
runs-on: windows-latest
1616

1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
1919
- name: Setup .NET
20-
uses: actions/setup-dotnet@v4
20+
uses: actions/setup-dotnet@v5
2121
with:
22-
dotnet-version: 9.0.x
22+
dotnet-version: '10.0.x'
23+
dotnet-quality: 'preview'
2324
- name: Restore dependencies
2425
run: dotnet restore
2526
- name: Build
2627
run: dotnet build --no-restore
2728
- name: Build release
2829
run: dotnet build --configuration Release --no-restore
2930
- name: Test
30-
run: dotnet test --no-build --verbosity normal
31+
run: |
32+
$resultsDir = Join-Path $PWD.Path 'artifacts/test-results/debug'
33+
New-Item -ItemType Directory -Force -Path $resultsDir | Out-Null
34+
35+
dotnet test --no-build `
36+
-p:TestingPlatformCaptureOutput=false `
37+
-- `
38+
--results-directory "$resultsDir" `
39+
--report-xunit-trx `
40+
--show-live-output on
3141
- name: Test release
32-
run: dotnet test --configuration Release --no-build --verbosity normal
42+
run: |
43+
$resultsDir = Join-Path $PWD.Path 'artifacts/test-results/release'
44+
New-Item -ItemType Directory -Force -Path $resultsDir | Out-Null
45+
46+
dotnet test -c Release --no-build `
47+
-p:TestingPlatformCaptureOutput=false `
48+
-- `
49+
--results-directory "$resultsDir" `
50+
--report-xunit-trx `
51+
--show-live-output on
52+
- name: Upload raw logs
53+
if: always()
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: mtp-logs
57+
path: |
58+
artifacts/test-results/**/*.trx
59+
if-no-files-found: warn
60+
retention-days: 14

.github/workflows/publish.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ jobs:
1313
runs-on: windows-latest
1414

1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
with: { fetch-depth: 0 }
1818
- name: Setup .NET
19-
uses: actions/setup-dotnet@v4
19+
uses: actions/setup-dotnet@v5
2020
with:
21-
dotnet-version: 9.0.x
21+
dotnet-version: '10.0.x'
22+
dotnet-quality: 'preview'
2223
- name: Restore dependencies
2324
run: dotnet restore
2425
- name: Build

Directory.Build.props

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@
55
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
66
Condition="'$(ImportCommonProps)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
77

8+
<PropertyGroup>
9+
<!--
10+
Cross-platform targetting in .NET
11+
https://learn.microsoft.com/dotnet/standard/library-guidance/cross-platform-targeting
12+
-->
13+
14+
<!--
15+
Want to keep current and support the most recent LTS.
16+
-->
17+
<DotNetCoreVersion>net10.0</DotNetCoreVersion>
18+
19+
<!--
20+
4.7.2 addresses issues when consuming .NET Standard 2.0 libraries from .NET Framework.
21+
22+
Windows 10 1803 and Server 2019 included 4.7.2 in the box. Most OSes have gone out of support that shipped with
23+
earlier versions. The only exceptions are enterprise and server versions from 2016. We could support 4.6.2
24+
instead if the need arises, but starting with 4.7.2 to be explicit about the best choice.
25+
https://learn.microsoft.com/lifecycle/products/windows-81
26+
https://learn.microsoft.com/lifecycle/products/windows-7
27+
https://learn.microsoft.com/lifecycle/products/windows-server-2016
28+
https://learn.microsoft.com/lifecycle/products/windows-10-2016-ltsb
29+
-->
30+
<DotNetFrameworkVersion>net472</DotNetFrameworkVersion>
31+
32+
<WindowsPlatformVersion>windows10.0.22000.0</WindowsPlatformVersion>
33+
34+
<!-- C# Features -->
35+
<ImplicitUsings>enable</ImplicitUsings>
36+
<Nullable>enable</Nullable>
37+
<LangVersion>14</LangVersion>
38+
39+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
40+
</PropertyGroup>
41+
842
<!-- Common repo directories -->
943
<PropertyGroup>
1044
<RepoDir>$(MSBuildThisFileDirectory)</RepoDir>
@@ -16,11 +50,6 @@
1650

1751
<!-- Input Directories -->
1852
<PackagesDir Condition="'$(PackagesDir)'==''">$(RepoDir)packages\</PackagesDir>
19-
<ImplicitUsings>enable</ImplicitUsings>
20-
<Nullable>enable</Nullable>
21-
<LangVersion>latest</LangVersion>
22-
23-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2453
</PropertyGroup>
2554

2655
<!-- Set default Configuration and Platform -->

Directory.Packages.props

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!-- Enable central package management, https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management -->
4+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageVersion Include="KlutzyNinja.Madowaku" Version="0.1.0-alpha.2" />
8+
<PackageVersion Include="BenchmarkDotNet" Version="0.15.2" />
9+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
10+
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
11+
<PackageVersion Include="Microsoft.Build" Version="17.14.8" />
12+
<PackageVersion Include="Microsoft.CodeAnalysis.ResxSourceGenerator" Version="5.0.0-1.25277.114" />
13+
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
14+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
15+
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.183" />
16+
<PackageVersion Include="MinVer" Version="6.0.0" />
17+
<PackageVersion Include="xunit.v3" Version="3.0.1" />
18+
</ItemGroup>
19+
<ItemGroup Condition="'$(TargetFramework)' != '$(DotNetCoreVersion)' and '$(TargetFramework)' != '$(DotNetCoreVersion)-$(WindowsPlatformVersion)'">
20+
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
21+
<PackageVersion Include="Microsoft.Bcl.Memory" Version="9.0.9" />
22+
<PackageVersion Include="Microsoft.IO.Redist" Version="6.1.3" />
23+
<PackageVersion Include="PolySharp" Version="1.15.0" />
24+
<PackageVersion Include="System.Memory" Version="4.6.3" />
25+
</ItemGroup>
26+
</Project>

vsinterop.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<File Path=".gitattributes" />
88
<File Path=".gitignore" />
99
<File Path="Directory.Build.props" />
10+
<File Path="Directory.Packages.props" />
1011
<File Path="LICENSE" />
1112
<File Path="README.md" />
1213
<File Path="THIRD-PARTY-NOTICES.TXT" />

vsinterop.tests/vsinterop.tests.csproj

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<!--
5-
Multitarget .NET 9 and .NET Framework 4.72 on Windows 11 or higher.
6-
https://learn.microsoft.com/dotnet/standard/frameworks
7-
8-
Because we're multitargeting, we need to specify SupportedPlatform
9-
to get proper platform compatibility warnings.
10-
https://learn.microsoft.com/dotnet/standard/analyzers/platform-compat-analyzer
11-
-->
12-
<TargetFrameworks>net9.0-windows10.0.22000.0;net472</TargetFrameworks>
13-
<SupportedPlatform>windows10.0.22000.0</SupportedPlatform>
4+
<TargetFrameworks>$(DotNetCoreVersion)-$(WindowsPlatformVersion);$(DotNetFrameworkVersion)</TargetFrameworks>
5+
<SupportedPlatform>$(WindowsPlatformVersion)</SupportedPlatform>
6+
<OutputType>Exe</OutputType>
147

158
<ImplicitUsings>enable</ImplicitUsings>
169
<Nullable>enable</Nullable>
1710
<IsPackable>false</IsPackable>
1811
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1912
<RootNamespace/>
13+
14+
<!-- Use the Microsoft Testing Platform -->
15+
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
2016
</PropertyGroup>
2117

2218
<ItemGroup>
23-
<PackageReference Include="coverlet.collector" Version="6.0.2" />
24-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
25-
<PackageReference Include="xunit" Version="2.9.2" />
26-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
19+
<PackageReference Include="coverlet.collector"/>
20+
<PackageReference Include="xunit.v3"/>
21+
<PackageReference Include="FluentAssertions" />
2722
</ItemGroup>
2823

2924
<ItemGroup>

vsinterop/vsinterop.csproj

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,20 @@
22

33
<PropertyGroup>
44
<!--
5-
Multitarget .NET 9 and .NET Framework 4.72 on Windows 11 or higher.
6-
https://learn.microsoft.com/dotnet/standard/frameworks
7-
8-
Because we're multitargeting, we need to specify SupportedPlatform
9-
to get proper platform compatibility warnings.
5+
Because we're multitargeting, we need to specify SupportedPlatform to get proper platform compatibility warnings.
106
https://learn.microsoft.com/dotnet/standard/analyzers/platform-compat-analyzer
117
12-
Including just net9.0 if users want to build for .NET 9 and do a runtime check.
8+
Including platform specific and non-platform specific target frameworks to allow use with a runtime check.
139
-->
14-
<TargetFrameworks>net9.0-windows10.0.22000.0;net9.0;net472</TargetFrameworks>
15-
<SupportedPlatform>windows10.0.22000.0</SupportedPlatform>
10+
<TargetFrameworks>$(DotNetCoreVersion)-$(WindowsPlatformVersion);$(DotNetCoreVersion);$(DotNetFrameworkVersion)</TargetFrameworks>
11+
<SupportedPlatform>$(WindowsPlatformVersion)</SupportedPlatform>
1612

17-
<!-- Ignore checking for compatibilty when targetting .NET 9 without the windows qualifier -->
18-
<NoWarn Condition="'$(TargetFramework)' == 'net9.0'">$(NoWarn);CA1416</NoWarn>
13+
<!-- Ignore checking for compatibilty when targetting .NET Core without the windows qualifier -->
14+
<NoWarn Condition="'$(TargetFramework)' == '$(DotNetCoreVersion)'">$(NoWarn);CA1416</NoWarn>
1915

2016
<!--
21-
We don't want to have implicit usings as we're retargeting System.IO to Microsoft.IO
22-
in our GlobalUsings.cs file for .NET 4.7.2.
17+
We don't want to have implicit usings as we're retargeting System.IO to Microsoft.IO
18+
in our GlobalUsings.cs file for .NET 4.7.2.
2319
-->
2420
<ImplicitUsings>disable</ImplicitUsings>
2521
<Nullable>enable</Nullable>
@@ -34,24 +30,26 @@
3430
<!--
3531
Modifying default items to exclude the Framework items if not building for .NET Framework.
3632
-->
37-
<DefaultItemExcludes Condition="'$(TargetFramework)' != 'net472'">$(DefaultItemExcludes);**/Framework/**/*</DefaultItemExcludes>
33+
<DefaultItemExcludes Condition="'$(TargetFramework)' != '$(DotNetFrameworkVersion)'">$(DefaultItemExcludes);**/Framework/**/*</DefaultItemExcludes>
3834
</PropertyGroup>
3935

40-
<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
36+
<ItemGroup Condition="'$(TargetFramework)' != '$(DotNetFrameworkVersion)'">
4137
<!-- Include the Framework specific items as none so we can see them easily in the Solution Explorer. -->
4238
<None Include="**/Framework/**/*" />
4339
</ItemGroup>
4440

4541
<ItemGroup>
46-
<PackageReference Include="KlutzyNinja.Madowaku" Version="0.1.0-alpha.2" />
47-
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183">
48-
<PrivateAssets>all</PrivateAssets>
49-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
50-
</PackageReference>
42+
<Compile Remove="Framework\**" />
43+
<EmbeddedResource Remove="Framework\**" />
44+
<None Remove="Framework\**" />
5145
</ItemGroup>
5246

5347
<ItemGroup>
54-
<Folder Include="Framework\" />
48+
<PackageReference Include="KlutzyNinja.Madowaku" />
49+
<PackageReference Include="Microsoft.Windows.CsWin32">
50+
<PrivateAssets>all</PrivateAssets>
51+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
52+
</PackageReference>
5553
</ItemGroup>
5654

5755
<!--
@@ -78,7 +76,7 @@
7876
SourceLink related
7977
-->
8078
<ItemGroup>
81-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
79+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
8280
</ItemGroup>
8381
<PropertyGroup>
8482
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
@@ -102,7 +100,7 @@
102100
<MinVerTagPrefix>v</MinVerTagPrefix>
103101
</PropertyGroup>
104102
<ItemGroup>
105-
<PackageReference Include="MinVer" Version="6.0.0">
103+
<PackageReference Include="MinVer">
106104
<PrivateAssets>all</PrivateAssets>
107105
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
108106
</PackageReference>

0 commit comments

Comments
 (0)