Skip to content

Commit b957917

Browse files
authored
Add support for .NET 10 (#124)
* Fixed: do not silently fail on nonzero exit code * Add support for .NET 10; align with default project template from VS2026 * Update GHA * Simplify project file assertions
1 parent d0965e2 commit b957917

33 files changed

Lines changed: 459 additions & 153 deletions

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
6.0.*
4444
8.0.*
4545
9.0.*
46+
10.0.*
4647
4748
- name: Git checkout
4849
uses: actions/checkout@v4
@@ -145,7 +146,7 @@ jobs:
145146
- name: Setup .NET
146147
uses: actions/setup-dotnet@v4
147148
with:
148-
dotnet-version: 8.0.*
149+
dotnet-version: 10.0.*
149150

150151
- name: Install code signing tool
151152
run: dotnet tool install --global sign --prerelease
@@ -205,7 +206,7 @@ jobs:
205206
- name: Setup .NET
206207
uses: actions/setup-dotnet@v4
207208
with:
208-
dotnet-version: 8.0.x
209+
dotnet-version: 10.0.x
209210
source-url: ${{ vars.AZURE_ARTIFACTS_FEED_URL }}
210211
env:
211212
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -236,7 +237,7 @@ jobs:
236237
- name: Setup .NET
237238
uses: actions/setup-dotnet@v4
238239
with:
239-
dotnet-version: 8.0.x
240+
dotnet-version: 10.0.x
240241

241242
- name: Download signed packages
242243
uses: actions/download-artifact@v4
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md
26+
!**/.gitignore
27+
!.git/HEAD
28+
!.git/config
29+
!.git/packed-refs
30+
!.git/refs/heads/**

src/Content/NetCoreTool.Template.WebApi/CSharp/.gitignore

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*.user
1010
*.userosscache
1111
*.sln.docstates
12+
*.env
1213

1314
# User-specific files (MonoDevelop/Xamarin Studio)
1415
*.userprefs
@@ -21,17 +22,37 @@ mono_crash.*
2122
[Dd]ebugPublic/
2223
[Rr]elease/
2324
[Rr]eleases/
24-
x64/
25-
x86/
25+
26+
[Dd]ebug/x64/
27+
[Dd]ebugPublic/x64/
28+
[Rr]elease/x64/
29+
[Rr]eleases/x64/
30+
bin/x64/
31+
obj/x64/
32+
33+
[Dd]ebug/x86/
34+
[Dd]ebugPublic/x86/
35+
[Rr]elease/x86/
36+
[Rr]eleases/x86/
37+
bin/x86/
38+
obj/x86/
39+
2640
[Ww][Ii][Nn]32/
2741
[Aa][Rr][Mm]/
2842
[Aa][Rr][Mm]64/
43+
[Aa][Rr][Mm]64[Ee][Cc]/
2944
bld/
30-
[Bb]in/
3145
[Oo]bj/
46+
[Oo]ut/
3247
[Ll]og/
3348
[Ll]ogs/
3449

50+
# Build results on 'Bin' directories
51+
**/[Bb]in/*
52+
# Uncomment if you have tasks that rely on *.refresh files to move binaries
53+
# (https://github.com/github/gitignore/pull/3736)
54+
#!**/[Bb]in/*.refresh
55+
3556
# Visual Studio 2015/2017 cache/options directory
3657
.vs/
3758
# Uncomment if you have tasks that create the project's static files in wwwroot
@@ -43,12 +64,16 @@ Generated\ Files/
4364
# MSTest test Results
4465
[Tt]est[Rr]esult*/
4566
[Bb]uild[Ll]og.*
67+
*.trx
4668

4769
# NUnit
4870
*.VisualState.xml
4971
TestResult.xml
5072
nunit-*.xml
5173

74+
# Approval Tests result files
75+
*.received.*
76+
5277
# Build Results of an ATL Project
5378
[Dd]ebugPS/
5479
[Rr]eleasePS/
@@ -75,6 +100,7 @@ StyleCopReport.xml
75100
*.ilk
76101
*.meta
77102
*.obj
103+
*.idb
78104
*.iobj
79105
*.pch
80106
*.pdb
@@ -155,6 +181,7 @@ coverage*.info
155181

156182
# NCrunch
157183
_NCrunch_*
184+
.NCrunch_*
158185
.*crunch*.local.xml
159186
nCrunchTemp_*
160187

@@ -296,9 +323,6 @@ node_modules/
296323
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
297324
*.vbw
298325

299-
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
300-
*.vbp
301-
302326
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
303327
*.dsw
304328
*.dsp
@@ -316,22 +340,22 @@ node_modules/
316340
_Pvt_Extensions
317341

318342
# Paket dependency manager
319-
.paket/paket.exe
343+
**/.paket/paket.exe
320344
paket-files/
321345

322346
# FAKE - F# Make
323-
.fake/
347+
**/.fake/
324348

325349
# CodeRush personal settings
326-
.cr/personal
350+
**/.cr/personal
327351

328352
# Python Tools for Visual Studio (PTVS)
329-
__pycache__/
353+
**/__pycache__/
330354
*.pyc
331355

332356
# Cake - Uncomment if you are using it
333-
# tools/**
334-
# !tools/packages.config
357+
#tools/**
358+
#!tools/packages.config
335359

336360
# Tabs Studio
337361
*.tss
@@ -353,15 +377,19 @@ ASALocalRun/
353377

354378
# MSBuild Binary and Structured Log
355379
*.binlog
380+
MSBuild_Logs/
381+
382+
# AWS SAM Build and Temporary Artifacts folder
383+
.aws-sam
356384

357385
# NVidia Nsight GPU debugger configuration file
358386
*.nvuser
359387

360388
# MFractors (Xamarin productivity tool) working folder
361-
.mfractor/
389+
**/.mfractor/
362390

363391
# Local History for Visual Studio
364-
.localhistory/
392+
**/.localhistory/
365393

366394
# Visual Studio History (VSHistory) files
367395
.vshistory/
@@ -373,7 +401,7 @@ healthchecksdb
373401
MigrationBackup/
374402

375403
# Ionide (cross platform F# VS Code tools) working folder
376-
.ionide/
404+
**/.ionide/
377405

378406
# Fody - auto-generated XML schema
379407
FodyWeavers.xsd
@@ -384,17 +412,17 @@ FodyWeavers.xsd
384412
!.vscode/tasks.json
385413
!.vscode/launch.json
386414
!.vscode/extensions.json
387-
*.code-workspace
415+
!.vscode/*.code-snippets
388416

389417
# Local History for Visual Studio Code
390418
.history/
391419

420+
# Built Visual Studio Code Extensions
421+
*.vsix
422+
392423
# Windows Installer files from build outputs
393424
*.cab
394425
*.msi
395426
*.msix
396427
*.msm
397428
*.msp
398-
399-
# JetBrains Rider
400-
*.sln.iml

src/Content/NetCoreTool.Template.WebApi/CSharp/.template.config/template.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
"Dockerfile"
5454
]
5555
},
56+
{
57+
"condition": "(!DockerfileOption)",
58+
"exclude": [
59+
".dockerignore"
60+
]
61+
},
5662
{
5763
"condition": "(!HasMessagingRabbitMqListenerInSteeltoeV3)",
5864
"exclude": [
@@ -79,6 +85,10 @@
7985
{
8086
"choice": "net9.0",
8187
"description": "Target net9.0"
88+
},
89+
{
90+
"choice": "net10.0",
91+
"description": "Target net10.0"
8292
}
8393
],
8494
"defaultValue": "net8.0",
@@ -111,6 +121,15 @@
111121
"pattern": "^net9\\.0$"
112122
}
113123
},
124+
"IsFrameworkNet100": {
125+
"type": "generated",
126+
"generator": "regexMatch",
127+
"datatype": "bool",
128+
"parameters": {
129+
"source": "Framework",
130+
"pattern": "^net10\\.0$"
131+
}
132+
},
114133
"SteeltoeVersionOption": {
115134
"description": "The Steeltoe version to use.",
116135
"type": "parameter",
@@ -773,6 +792,10 @@
773792
"parameters": {
774793
"datatype": "string",
775794
"cases": [
795+
{
796+
"condition": "(Framework == 'net10.0')",
797+
"value": "6.1.*"
798+
},
776799
{
777800
"condition": "(Framework == 'net9.0')",
778801
"value": "6.0.*"
@@ -795,6 +818,10 @@
795818
"parameters": {
796819
"datatype": "string",
797820
"cases": [
821+
{
822+
"condition": "(Framework == 'net10.0')",
823+
"value": "9.6.*"
824+
},
798825
{
799826
"condition": "(Framework == 'net9.0')",
800827
"value": "9.3.*"

src/Content/NetCoreTool.Template.WebApi/CSharp/Company.WebApplication.CS.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
<!--#endif -->
88
<Nullable>enable</Nullable>
99
<ImplicitUsings>enable</ImplicitUsings>
10+
<!--#if (DockerfileOption) -->
11+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
12+
<DockerfileContext>.</DockerfileContext>
13+
<!--#endif -->
1014
</PropertyGroup>
15+
<!--#if (HasAnySteeltoe) -->
1116

1217
<PropertyGroup>
1318
<!--#if (HasChosenSteeltoeVersionInIDE) -->
@@ -16,12 +21,15 @@
1621
<SteeltoeVersion>$(SteeltoeVersionInCLI)</SteeltoeVersion>
1722
<!--#endif -->
1823
</PropertyGroup>
24+
<!--#endif -->
1925

2026
<ItemGroup>
21-
<PackageReference Include="Swashbuckle.AspNetCore" Condition="'$(IsFrameworkNet60)' == 'True'" Version="6.5.0" />
2227
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Condition="'$(IsFrameworkNet80)' == 'True'" Version="8.0.*" />
23-
<PackageReference Include="Swashbuckle.AspNetCore" Condition="'$(IsFrameworkNet80)' == 'True'" Version="6.6.2" />
2428
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Condition="'$(IsFrameworkNet90)' == 'True'" Version="9.0.*" />
29+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Condition="'$(IsFrameworkNet100)' == 'True'" Version="10.0.*" />
30+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Condition="'$(DockerfileOption)' == 'True'" Version="1.23.0" />
31+
<PackageReference Include="Swashbuckle.AspNetCore" Condition="'$(IsFrameworkNet60)' == 'True'" Version="6.5.0" />
32+
<PackageReference Include="Swashbuckle.AspNetCore" Condition="'$(IsFrameworkNet80)' == 'True'" Version="6.6.2" />
2533
</ItemGroup>
2634
<!--#if (HasAnySteeltoe) -->
2735

src/Content/NetCoreTool.Template.WebApi/CSharp/Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
77
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
88
#elif (IsFrameworkNet90)
99
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
10+
#elif (IsFrameworkNet100)
11+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
1012
#endif
11-
#if (IsFrameworkNet80 || IsFrameworkNet90)
13+
#if (IsFrameworkNet80 || IsFrameworkNet90 || IsFrameworkNet100)
1214
USER $APP_UID
1315
#endif
1416
WORKDIR /app
@@ -24,12 +26,12 @@ EXPOSE 8081
2426
# This stage is used to build the service project
2527
#if (IsFrameworkNet60)
2628
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
27-
#endif
28-
#if (IsFrameworkNet80)
29+
#elif (IsFrameworkNet80)
2930
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
30-
#endif
31-
#if (IsFrameworkNet90)
31+
#elif (IsFrameworkNet90)
3232
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
33+
#elif (IsFrameworkNet100)
34+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
3335
#endif
3436
ARG BUILD_CONFIGURATION=Release
3537
WORKDIR /src

src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
152152
builder.Services.AddEndpointsApiExplorer();
153153
builder.Services.AddSwaggerGen();
154-
#elif (IsFrameworkNet90)
154+
#elif (IsFrameworkNet90 || IsFrameworkNet100)
155155
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
156156
builder.Services.AddOpenApi();
157157
#endif
@@ -345,7 +345,7 @@
345345
#if (IsFrameworkNet60 || IsFrameworkNet80)
346346
app.UseSwagger();
347347
app.UseSwaggerUI();
348-
#elif (IsFrameworkNet90)
348+
#elif (IsFrameworkNet90 || IsFrameworkNet100)
349349
app.MapOpenApi();
350350
#endif
351351
}
@@ -376,11 +376,11 @@
376376
.ToArray();
377377
return forecast;
378378
})
379-
#if (IsFrameworkNet60)
380-
.WithName("GetWeatherForecast");
381-
#else
379+
#if (IsFrameworkNet80)
382380
.WithName("GetWeatherForecast")
383381
.WithOpenApi();
382+
#else
383+
.WithName("GetWeatherForecast");
384384
#endif
385385

386386
#if (HasMessagingRabbitMqClientInSteeltoeV3)

0 commit comments

Comments
 (0)