Skip to content

Commit a18b9ca

Browse files
authored
NET 10 Updates (#970)
* Configured sending serilog to aspire structured logs * Update Aspire integration * add scalar support * update to net10 * Lots of updates: net10 Vogen Mediator Packages Updated * adding more tests updating nuspec * Update template settings * Change pack command from dotnet to nuget * Install NuGet CLI and update pack command Added installation step for NuGet CLI and updated pack command to include PATH export. * Replace NuGet CLI installation with setup action * Update publish.yml * Update publish.yml * Update Mono installation to use mono-complete * fix an aspire directive * Updates for net10 release * Update aspire * Updating to use SQL Server in a container * Update to use the right EF Core Design package * Exclude content files to stop BuildHost-net472 folders from appearing * Added papercut for email testing with aspire docker image * UpdateName only sends events if there is a change. Add unit tests * Make tests run in parallel (all 3 projects) by default. Configure testcontainers for functional tests * Update Serilog to work properly with OTEL and structured logging * Update version * update when to try to publish to nuget
1 parent 39c32a0 commit a18b9ca

File tree

117 files changed

+1872
-839
lines changed

Some content is hidden

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

117 files changed

+1872
-839
lines changed

.aspire/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"appHostPath": "../src/Clean.Architecture.AspireHost/Clean.Architecture.AspireHost.csproj"
3+
}

.github/workflows/publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ jobs:
3434
- name: Test
3535
run: dotnet test "${{ env.SOLUTION_FILE }}" --configuration Release --no-build --no-restore
3636

37-
- name: Pack
38-
run: dotnet pack "${{ env.SOLUTION_FILE }}" -NoDefaultExcludes --configuration Release --no-build --no-restore --output "${{ env.PACK_OUTPUT }}"
37+
- uses: nuget/setup-nuget@v2
38+
name: Setup NuGet
39+
with:
40+
nuget-version: 'latest'
41+
42+
- name: Install Mono
43+
run: sudo apt-get update && sudo apt-get install -y mono-complete
44+
45+
- name: Pack (nuspec)
46+
run: nuget pack "${{ env.NUSPEC_FILE }}" -OutputDirectory "${{ env.PACK_OUTPUT }}" -NoDefaultExcludes
3947

4048
- name: NuGet login (OIDC -> temp API key)
4149
uses: NuGet/login@v1
@@ -44,7 +52,7 @@ jobs:
4452
user: ${{ secrets.NUGET_USER }}
4553

4654
- name: Push to NuGet
47-
if: startsWith(github.ref, 'refs/tags/') # only push if building a tag
55+
if: ${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.tag_name != '' }}
4856
shell: pwsh
4957
run: |
5058
Get-ChildItem "${{ env.PACK_OUTPUT }}" -Filter *.nupkg | ForEach-Object {

.runsettings

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RunSettings>
3+
<RunConfiguration>
4+
<!-- Enable parallel test execution at the assembly level -->
5+
<MaxCpuCount>0</MaxCpuCount>
6+
<!-- 0 means use all available processors -->
7+
<DisableParallelization>false</DisableParallelization>
8+
</RunConfiguration>
9+
10+
<xUnit>
11+
<!-- Configure xUnit-specific settings -->
12+
<ParallelizeAssembly>true</ParallelizeAssembly>
13+
<ParallelizeTestCollections>true</ParallelizeTestCollections>
14+
<MaxParallelThreads>0</MaxParallelThreads>
15+
<!-- 0 means use default algorithm (processors * 2) -->
16+
</xUnit>
17+
</RunSettings>

.template.config/template.json

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json.schemastore.org/template",
3-
"author": "Steve Smith @ardalis, Erik Dahl",
3+
"author": "ardalis (Steve Smith)",
44
"classifications": [
55
"Web",
66
"ASP.NET",
@@ -16,14 +16,6 @@
1616
"sourceName": "Clean.Architecture",
1717
"templateFileExtensions": [ ".cs", ".csproj", ".slnx" ],
1818
"preferNameDirectory": true,
19-
"symbols": {
20-
"aspire": {
21-
"type": "parameter",
22-
"datatype": "bool",
23-
"defaultValue": "true",
24-
"description": "Include .NET Aspire."
25-
}
26-
},
2719
"sources": [
2820
{
2921
"include": [
@@ -34,18 +26,12 @@
3426
".vscode/**",
3527
".git/**",
3628
".github/**",
29+
".idea/**",
3730
".template.config/**",
31+
"docs/**",
3832
"sample/**"
3933
],
4034
"modifiers": [
41-
{
42-
"condition": "(!aspire)",
43-
"exclude": [
44-
"src/Clean.Architecture.AspireHost/**",
45-
"src/Clean.Architecture.ServiceDefaults/**",
46-
"tests/Clean.Architecture.AspireTests/**"
47-
]
48-
},
4935
{
5036
"condition": "true",
5137
"copyOnly": [ "*.dll", "*.png", "*.ico", "*.jpg", "*.jpeg", "*.ps1" ]
@@ -58,4 +44,4 @@
5844
]
5945
}
6046
]
61-
}
47+
}

Clean.Architecture-NoAspire.slnx

Lines changed: 0 additions & 28 deletions
This file was deleted.

Clean.Architecture.slnx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@
66
</Configurations>
77
<Folder Name="/Solution Items/">
88
<File Path=".editorconfig" />
9+
<File Path=".template.config/template.json" />
910
<File Path="CleanArchitecture.nuspec" />
1011
<File Path="Directory.Build.props" />
1112
<File Path="Directory.Packages.props" />
1213
</Folder>
1314
<Folder Name="/src/">
14-
<Project Path="src/Clean.Architecture.AspireHost/Clean.Architecture.AspireHost.csproj" />
15-
<Project Path="src/Clean.Architecture.ServiceDefaults/Clean.Architecture.ServiceDefaults.csproj" />
1615
<Project Path="src/Clean.Architecture.Core/Clean.Architecture.Core.csproj" />
1716
<Project Path="src/Clean.Architecture.Infrastructure/Clean.Architecture.Infrastructure.csproj" />
1817
<Project Path="src/Clean.Architecture.UseCases/Clean.Architecture.UseCases.csproj" />
1918
<Project Path="src/Clean.Architecture.Web/Clean.Architecture.Web.csproj" />
2019
</Folder>
20+
<Folder Name="/src/_aspire/">
21+
<Project Path="src/Clean.Architecture.AspireHost/Clean.Architecture.AspireHost.csproj" />
22+
<Project Path="src/Clean.Architecture.ServiceDefaults/Clean.Architecture.ServiceDefaults.csproj" />
23+
</Folder>
2124
<Folder Name="/tests/">
2225
<Project Path="tests/Clean.Architecture.FunctionalTests/Clean.Architecture.FunctionalTests.csproj">
2326
<BuildDependency Project="src/Clean.Architecture.Web/Clean.Architecture.Web.csproj" />

CleanArchitecture.nuspec

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<id>Ardalis.CleanArchitecture.Template</id>
55
<title>ASP.NET Core Clean Architecture Solution</title>
6-
<version>10.1.1</version>
6+
<version>11.0.0</version>
77
<authors>Steve Smith</authors>
88
<description>
99
The Clean Architecture Solution Template popularized by Steve @ardalis Smith. Provides a great starting point for modern and/or DDD solutions built with .NET 8 and C# 12.
@@ -13,8 +13,7 @@
1313
<license type="expression">MIT</license>
1414
<projectUrl>https://github.com/ardalis/CleanArchitecture</projectUrl>
1515
<releaseNotes>
16-
* Aspire on by default
17-
* Fixes issues with sln/slnx files
16+
* Update everything to .NET 10 latest
1817
</releaseNotes>
1918
<packageTypes>
2019
<packageType name="Template" />

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<PropertyGroup>
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
8+
<LangVersion>latest</LangVersion>
89
</PropertyGroup>
910
<PropertyGroup>
1011
<NoWarn>1591</NoWarn> <!-- Remove this to turn on warnings for missing XML Comments -->

Directory.Packages.props

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,53 @@
55
<PackageVersion Include="Ardalis.ListStartupServices" Version="1.1.4" />
66
<PackageVersion Include="Ardalis.Result" Version="10.1.0" />
77
<PackageVersion Include="Ardalis.Result.AspNetCore" Version="10.1.0" />
8-
<PackageVersion Include="Ardalis.SharedKernel" Version="3.0.1" />
8+
<PackageVersion Include="Ardalis.SharedKernel" Version="4.1.0" />
99
<PackageVersion Include="Ardalis.SmartEnum" Version="8.2.0" />
10-
<PackageVersion Include="Ardalis.Specification" Version="9.2.0" />
11-
<PackageVersion Include="Ardalis.Specification.EntityFrameworkCore" Version="9.2.0" />
12-
<PackageVersion Include="Azure.Identity" Version="1.13.1" />
10+
<PackageVersion Include="Ardalis.Specification" Version="9.3.1" />
11+
<PackageVersion Include="Ardalis.Specification.EntityFrameworkCore" Version="9.3.1" />
12+
<PackageVersion Include="Azure.Identity" Version="1.17.0" />
1313
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
14-
<PackageVersion Include="FastEndpoints" Version="6.2.0" />
14+
<PackageVersion Include="FastEndpoints" Version="7.1.1" />
1515
<PackageVersion Include="FastEndpoints.ApiExplorer" Version="2.2.0" />
16-
<PackageVersion Include="FastEndpoints.Swagger" Version="6.2.0" />
17-
<PackageVersion Include="FastEndpoints.Swagger.Swashbuckle" Version="2.2.0" />
18-
<PackageVersion Include="MailKit" Version="4.13.0" />
19-
<PackageVersion Include="MediatR" Version="12.5.0" />
20-
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.6" />
21-
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.6" />
22-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.6" />
23-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.6" />
24-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.6" />
25-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.6" />
26-
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.6" />
27-
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.6" />
28-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.6" />
29-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.6" />
30-
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.6" />
31-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
16+
<PackageVersion Include="FastEndpoints.Swagger" Version="7.1.1" />
17+
<PackageVersion Include="MailKit" Version="4.14.1" />
18+
<PackageVersion Include="Mediator.Abstractions" Version="3.0.1" />
19+
<PackageVersion Include="Mediator.SourceGenerator" Version="3.0.1" />
20+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
21+
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.0" />
22+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.0" />
23+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0" />
24+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.0" />
25+
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0" />
26+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.0" />
27+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.0" />
28+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
29+
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.0" />
30+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
31+
<PackageVersion Include="NimblePros.Metronome" Version="0.4.1" />
3232
<PackageVersion Include="NSubstitute" Version="5.3.0" />
33-
<PackageVersion Include="ReportGenerator" Version="5.4.8" />
33+
<PackageVersion Include="ReportGenerator" Version="5.5.0" />
34+
<PackageVersion Include="Scalar.AspNetCore" Version="2.10.3" />
3435
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
36+
<PackageVersion Include="Serilog.Sinks.OpenTelemetry" Version="4.2.0" />
3537
<PackageVersion Include="Shouldly" Version="4.3.0" />
3638
<PackageVersion Include="SQLite" Version="3.13.0" />
3739
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
3840
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
41+
<PackageVersion Include="Testcontainers" Version="4.3.0" />
42+
<PackageVersion Include="Testcontainers.MsSql" Version="4.3.0" />
3943
<PackageVersion Include="xunit" Version="2.9.3" />
40-
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
41-
<!--#if (aspire) -->
42-
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.0.0" />
43-
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.6.0" />
44-
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="9.3.1" />
45-
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
46-
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
47-
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
48-
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
49-
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
50-
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.0.0" />
51-
<!--#endif -->
44+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
45+
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.0.0" />
46+
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="13.0.0" />
47+
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.0.0" />
48+
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="10.0.0" />
49+
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" />
50+
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
51+
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.13.0" />
52+
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.13.0" />
53+
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.13.0" />
54+
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.5.1" />
55+
<PackageVersion Include="Vogen" Version="8.0.2" />
5256
</ItemGroup>
5357
</Project>

PARALLEL_TEST_EXECUTION.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Parallel Test Execution Configuration
2+
3+
This workspace is configured to run all three test projects in parallel in Visual Studio Test Explorer.
4+
5+
## Configuration Files
6+
7+
### `.runsettings` (Solution Root)
8+
- Enables parallel test execution at the assembly level
9+
- `MaxCpuCount=0` uses all available processors to run test assemblies in parallel
10+
- `DisableParallelization=false` ensures parallelization is enabled
11+
12+
### `xunit.runner.json` (In Each Test Project)
13+
Each test project contains an `xunit.runner.json` file with:
14+
- `parallelizeAssembly: true` - Allows tests from this assembly to run in parallel with other assemblies
15+
- `parallelizeTestCollections: true` - Runs test collections within the assembly in parallel
16+
- `maxParallelThreads: 0` - Uses xUnit's default algorithm (processors × 2)
17+
18+
## How to Use in Visual Studio
19+
20+
### Option 1: Configure via Test Explorer Settings
21+
1. Open **Test Explorer** (Test ? Test Explorer)
22+
2. Click the settings icon (??) in the toolbar
23+
3. Select **Configure Run Settings** ? **Select Solution Wide runsettings File**
24+
4. Browse to and select the `.runsettings` file at the solution root
25+
26+
### Option 2: Configure via Visual Studio Settings
27+
1. Go to **Tools** ? **Options**
28+
2. Navigate to **Test** ? **General**
29+
3. Under **Run Settings File**, browse and select the `.runsettings` file
30+
31+
### Option 3: Automatic Detection
32+
Visual Studio will automatically detect and use `.runsettings` in the solution root in most cases.
33+
34+
## Verification
35+
36+
After configuration, when you run all tests:
37+
- The three test projects (UnitTests, IntegrationTests, FunctionalTests) will run in parallel
38+
- Within each project, test collections will also run in parallel
39+
- You should see multiple tests running simultaneously in Test Explorer
40+
41+
## Performance Considerations
42+
43+
**Recommended for:**
44+
- Fast unit tests (UnitTests project)
45+
- Independent integration tests that don't share state
46+
47+
**Use with caution for:**
48+
- Tests using shared resources (databases, files, ports)
49+
- Tests with Testcontainers - these may need collection fixtures to control parallelization
50+
51+
If you encounter issues with FunctionalTests (which use Testcontainers), you may need to:
52+
1. Disable parallelization for that specific project by setting `parallelizeAssembly: false` in its `xunit.runner.json`
53+
2. Use xUnit Collection Fixtures to control which tests can run in parallel
54+
3. Configure Testcontainers to use unique ports/databases per test class
55+
56+
## Disabling Parallel Execution
57+
58+
To disable parallel execution for a specific test project, update its `xunit.runner.json`:
59+
```json
60+
{
61+
"shadowCopy": false,
62+
"parallelizeAssembly": false,
63+
"parallelizeTestCollections": false
64+
}
65+
```
66+
67+
## Command Line Usage
68+
69+
To use the .runsettings file when running tests from the command line:
70+
```bash
71+
dotnet test --settings .runsettings
72+
```
73+
74+
## Related Documentation
75+
- [xUnit Parallel Test Execution](https://xunit.net/docs/running-tests-in-parallel)
76+
- [Visual Studio Run Settings](https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file)

0 commit comments

Comments
 (0)