Skip to content

Commit 372f7a6

Browse files
Copilotjohnkors
andauthored
Add .NET 10 support with .NET 9 multitargeting (#9)
* Initial plan * Upgrade to .NET 10 with multitargeting for .NET 9 Co-authored-by: johnkors <206726+johnkors@users.noreply.github.com> * Bump GitHub Actions to v5 (checkout and setup-dotnet) Co-authored-by: johnkors <206726+johnkors@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: johnkors <206726+johnkors@users.noreply.github.com>
1 parent 136a54c commit 372f7a6

6 files changed

Lines changed: 29 additions & 27 deletions

File tree

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v4
11-
- uses: actions/setup-dotnet@v4
10+
- uses: actions/checkout@v5
11+
- uses: actions/setup-dotnet@v5
1212
with:
13-
dotnet-version: 9.0.x
13+
dotnet-version: 10.0.x
1414
- run: dotnet restore source
1515
- run: dotnet build --no-restore source
1616
- run: dotnet test source /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --logger "GitHubActions;report-warnings=false"

.github/workflows/PreRelease.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212
with:
1313
fetch-depth: 0
1414
- run: echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV
@@ -19,8 +19,8 @@ jobs:
1919
id: gitversion
2020
with:
2121
useConfigFile: true
22-
- uses: actions/setup-dotnet@v4
22+
- uses: actions/setup-dotnet@v5
2323
with:
24-
dotnet-version: 9.0.x
24+
dotnet-version: 10.0.x
2525
- run: dotnet pack source /p:Version=${{ steps.gitversion.outputs.NuGetVersionV2 }}-${{ steps.gitversion.outputs.ShortSha }} /p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} /p:PackageReleaseNotes="https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ steps.gitversion.outputs.NuGetVersionV2 }}" -o ./releases
2626
- run: dotnet nuget push ./releases/**/*.nupkg -k=${{ secrets.NUGETORGAPIKEY }} -s=nuget.org

.github/workflows/Release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212
with:
1313
fetch-depth: 0
1414
- run: echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV
@@ -21,9 +21,9 @@ jobs:
2121
with:
2222
useConfigFile: true
2323
- name: Setup .NET
24-
uses: actions/setup-dotnet@v4
24+
uses: actions/setup-dotnet@v5
2525
with:
26-
dotnet-version: 9.0.x
26+
dotnet-version: 10.0.x
2727
- name: Pack
2828
run: dotnet pack source /p:Version=${{ steps.gitversion.outputs.majorMinorPatch }} /p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} /p:PackageReleaseNotes="https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ steps.gitversion.outputs.majorMinorPatch }}" -o ./releases
2929
- name: Publish

samples/With/With.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0"/>
10-
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0"/>
11-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0"/>
9+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0"/>
10+
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0"/>
11+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.0"/>
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/Without/Without.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Worker">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0"/>
10-
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0"/>
11-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0"/>
9+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0"/>
10+
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0"/>
11+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.0"/>
1212
</ItemGroup>
1313
</Project>

source/MinimalHttpLogger/MinimalHttpLogger.csproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<LangVersion>latest</LangVersion>
77
<Nullable>enable</Nullable>
@@ -16,16 +16,18 @@
1616
<RepositoryUrl>https://github.com/johnkors/MinimalHttpLogging</RepositoryUrl>
1717
</PropertyGroup>
1818

19-
<PropertyGroup>
20-
<DotNetVersion>9.0.0</DotNetVersion>
21-
</PropertyGroup>
22-
23-
<ItemGroup>
19+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
20+
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0"/>
21+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0"/>
22+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0"/>
23+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0"/>
24+
</ItemGroup>
2425

25-
<PackageReference Include="Microsoft.Extensions.Http" Version="$(DotNetVersion)"/>
26-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(DotNetVersion)"/>
27-
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(DotNetVersion)"/>
28-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(DotNetVersion)"/>
26+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
27+
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0"/>
28+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0"/>
29+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.0"/>
30+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0"/>
2931
</ItemGroup>
3032

3133
<ItemGroup>

0 commit comments

Comments
 (0)