Skip to content

Multi-target net8.0 alongside net10.0 - #11

Merged
Romain-OD merged 2 commits into
mainfrom
feat/multi-target-net8
Jul 29, 2026
Merged

Romain-OD merged 2 commits into
mainfrom
feat/multi-target-net8

Conversation

@Romain-OD

Copy link
Copy Markdown
Owner

Closes #5.

All ten published packages targeted net10.0 only, so a .NET 8 LTS application could not install any of them — dotnet add package MessageValidation failed outright rather than degrading. This adds net8.0 to the target framework matrix.

Changes

Ten packable projects — TargetFramework → TargetFrameworks:

-    <TargetFramework>net10.0</TargetFramework>
+    <TargetFrameworks>net8.0;net10.0</TargetFrameworks>

Ten unit test projects — same change, so the shipped net8.0 binaries are actually executed rather than merely compiled.

Both workflows — setup-dotnet now installs 8.0.x as well:

-          dotnet-version: '10.0.x'
+          dotnet-version: |
+            8.0.x
+            10.0.x

The .NET 10 SDK does not carry the .NET 8 runtime, so without this the net8.0 test run fails with "framework 'Microsoft.NETCore.App' version '8.0.0' was not found". It is applied to publish-nuget.yml too, so a release-time build can never depend on automatic targeting-pack download.

Ten README files — the ## Requirements line now reads - .NET 8.0+ (targets `net8.0` and `net10.0`). Each adapter package packs its own README (<None Include="README.md" Pack="true" />), so all ten were stale on NuGet.org, not just the root one.

Deliberately unchanged

  • MessageValidation.IntegrationTests and Example.ImmediateValidation stay net10.0 — neither is published, and doubling six container-backed tests buys nothing.
  • Microsoft.Extensions.* stays at 10.0.5 for both targets. Those packages are net8.0-compatible, so a .NET 8 app resolves them fine; the cost is that they get pulled up from the shared framework's 8.0.x. Conditioning the version per target framework is deferred to Centralize package metadata and dependency versions with Directory.Build.props and Directory.Packages.props #8, where Directory.Build.props makes it a few lines rather than a block in every project.
  • <Version> stays 2.1.0. Adding a target framework is not breaking, but picking the release version is the maintainer's call.
  • LangVersion stays 14.0 — language version is independent of target framework.

Verification

  • Build: Release build of the full solution succeeds, 0 Error(s). Warning count doubles exactly (every warning code has an even count), confirming these are the pre-existing XML-doc/analyzer warnings emitted once per target framework — none is net8.0-specific.
  • Tests: all 10 unit test projects pass under both net8.0 and net10.0. Core project: 40/40 on each.
  • Packages: all 10 .nupkg files contain both lib/net8.0/ and lib/net10.0/, with matching net8.0 and net10.0 .nuspec dependency groups.
  • Packed README: confirmed the corrected requirements line is present inside a built .nupkg.

Note on .NET 8 lifecycle

.NET 8 LTS support ends November 2026. This is a bridge for the installed base that has not yet migrated, not a permanent commitment — dropping net8.0 when it goes out of support is a reasonable follow-up for the next major version.

Romain-OD and others added 2 commits July 28, 2026 14:15
All ten published packages targeted net10.0 only, so a .NET 8 LTS
application could not install any of them. Add net8.0 to the target
framework matrix.

- 10 packable projects: TargetFramework -> TargetFrameworks net8.0;net10.0
- 10 unit test projects: same, so the shipped net8.0 binaries are
  actually executed rather than only compiled
- build.yml and publish-nuget.yml: install the 8.0.x SDK as well, since
  the .NET 10 SDK carries no .NET 8 runtime and net8.0 tests would
  otherwise fail to launch
- README files: state the supported frameworks; each adapter package
  packs its own README, so all ten needed the correction

MessageValidation.IntegrationTests and the example project stay on
net10.0 -- neither is published, and doubling the container-backed
tests buys nothing.

Microsoft.Extensions.* stays at 10.0.5 for both targets; those packages
are net8.0-compatible. Conditioning the version per target framework is
left for the Directory.Build.props work in #8.

Verified: Release build clean on both targets, all 10 unit test projects
pass under net8.0 and net10.0, and every .nupkg contains lib/net8.0 and
lib/net10.0 with matching nuspec dependency groups.

Closes #5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reuse the solution-level pack command from the publish workflow so all current and future packable projects are validated. This includes the previously omitted MessageValidation.ImmediateValidations package.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Romain-OD
Romain-OD merged commit aaefe42 into main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-target net8.0 alongside net10.0 so .NET 8 LTS apps can consume the packages

1 participant