Skip to content

Commit 5fd816f

Browse files
committed
Upgrade of Open-Source Component to .NET 10 and .NET 8 with Multi-Targeting Support
I led the modernization of an existing .NET component by upgrading it to support both .NET 10 and .NET 8, ensuring compatibility with the latest runtime improvements while maintaining stability for LTS adopters.
1 parent 5dede80 commit 5fd816f

File tree

9 files changed

+45
-20
lines changed

9 files changed

+45
-20
lines changed

.github/workflows/publish-package.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ jobs:
1919
- name: Checkout repository
2020
uses: actions/checkout@v3
2121

22-
- name: Setup .NET 8
22+
- name: Setup .NET SDKs
2323
uses: actions/setup-dotnet@v3
2424
with:
25-
dotnet-version: 8.0.x
25+
dotnet-version: |
26+
8.0.x
27+
9.0.x
28+
10.0.x
2629
2730
- name: Restore dependencies
2831
run: dotnet restore
@@ -45,4 +48,4 @@ jobs:
4548
run: dotnet pack -c Release -o out -p:PackageVersion=${{ steps.semantic.outputs.new_release_version }} -p:RepositoryUrl=${{env.CURRENT_REPO_URL}}
4649

4750
- name: Publish the package to nuget.org
48-
run: dotnet nuget push ./out/*.nupkg -n -d -k ${{ secrets.NUGET_AUTH_TOKEN}} -s https://api.nuget.org/v3/index.json
51+
run: dotnet nuget push ./out/*.nupkg -n -d -k ${{ secrets.NUGET_AUTH_TOKEN}} -s https://api.nuget.org/v3/index.json

.github/workflows/pull-request.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ jobs:
1515
- name: Checkout repository
1616
uses: actions/checkout@v3
1717

18-
- name: Setup .NET 8
18+
- name: Setup .NET SDKs
1919
uses: actions/setup-dotnet@v3
2020
with:
21-
dotnet-version: 8.0.x
21+
dotnet-version: |
22+
8.0.x
23+
9.0.x
24+
10.0.x
2225
2326
- name: Restore dependencies
2427
run: dotnet restore
@@ -27,4 +30,4 @@ jobs:
2730
run: dotnet build --no-restore
2831

2932
- name: Test
30-
run: dotnet test --no-build
33+
run: dotnet test --no-build
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
44
WORKDIR /app
55
EXPOSE 80
66
EXPOSE 443
77

8-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
8+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
99
WORKDIR /src
1010
COPY ["NetDevPack.Security.PasswordHasher.Identity.Demo/NetDevPack.Security.PasswordHasher.Identity.Demo.csproj", "NetDevPack.Security.PasswordHasher.Identity.Demo/"]
1111
RUN dotnet restore "NetDevPack.Security.PasswordHasher.Identity.Demo/NetDevPack.Security.PasswordHasher.Identity.Demo.csproj"
1212
COPY . .
1313
WORKDIR "/src/NetDevPack.Security.PasswordHasher.Identity.Demo"
14-
RUN dotnet build "NetDevPack.Security.PasswordHasher.Identity.Demo.csproj" -c Release -o /app/build
14+
RUN dotnet build "NetDevPack.Security.PasswordHasher.Identity.Demo.csproj" -c Release -o /app/build -f net10.0
1515

1616
FROM build AS publish
17-
RUN dotnet publish "NetDevPack.Security.PasswordHasher.Identity.Demo.csproj" -c Release -o /app/publish
17+
RUN dotnet publish "NetDevPack.Security.PasswordHasher.Identity.Demo.csproj" -c Release -o /app/publish -f net10.0
1818

1919
FROM base AS final
2020
WORKDIR /app
2121
COPY --from=publish /app/publish .
22-
ENTRYPOINT ["dotnet", "NetDevPack.Security.PasswordHasher.Identity.Demo.dll"]
22+
ENTRYPOINT ["dotnet", "NetDevPack.Security.PasswordHasher.Identity.Demo.dll"]

src/NetDevPack.Security.PasswordHasher.Identity.Demo/NetDevPack.Security.PasswordHasher.Identity.Demo.csproj

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk.Web">
23

34
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
56
<Nullable>enable</Nullable>
67
<ImplicitUsings>enable</ImplicitUsings>
78
<IsPackable>false</IsPackable>
89
</PropertyGroup>
910

11+
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0'">
12+
<AspNetCoreVersion>8.0.23</AspNetCoreVersion>
13+
<EfCoreVersion>8.0.23</EfCoreVersion>
14+
<AspNetCodeGenVersion>8.0.23</AspNetCodeGenVersion>
15+
</PropertyGroup>
16+
17+
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0'">
18+
<AspNetCoreVersion>9.0.12</AspNetCoreVersion>
19+
<EfCoreVersion>9.0.12</EfCoreVersion>
20+
<AspNetCodeGenVersion>9.0.12</AspNetCodeGenVersion>
21+
</PropertyGroup>
22+
23+
<PropertyGroup Condition="'$(TargetFramework)'=='net10.0'">
24+
<AspNetCoreVersion>10.0.2</AspNetCoreVersion>
25+
<EfCoreVersion>10.0.2</EfCoreVersion>
26+
<AspNetCodeGenVersion>10.0.2</AspNetCodeGenVersion>
27+
</PropertyGroup>
28+
1029
<ItemGroup>
11-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0" />
12-
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0" />
13-
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0" />
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
15-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">
30+
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="$(AspNetCoreVersion)" />
31+
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="$(AspNetCoreVersion)" />
32+
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="$(AspNetCoreVersion)" />
33+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EfCoreVersion)" />
34+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EfCoreVersion)">
1635
<PrivateAssets>all</PrivateAssets>
1736
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1837
</PackageReference>
19-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
20-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.0" />
38+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
39+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="$(AspNetCodeGenVersion)" />
2140
</ItemGroup>
2241

2342
<ItemGroup>
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)