Skip to content

Multi-target NuGet libraries for net8.0 and net10.0#2

Merged
philliphoff merged 1 commit into
mainfrom
philliphoff/multi-target-net8-libs
Apr 29, 2026
Merged

Multi-target NuGet libraries for net8.0 and net10.0#2
philliphoff merged 1 commit into
mainfrom
philliphoff/multi-target-net8-libs

Conversation

@philliphoff
Copy link
Copy Markdown
Owner

Why

The three NuGet-published libraries (EncDotNet.Iso8211, EncDotNet.S57, EncDotNet.Noaa) currently only ship a net10.0 assembly, which excludes consumers still on .NET 8 LTS. Adding net8.0 as a second TFM broadens reach to the large pool of LTS-pinned projects without requiring them to upgrade their runtime.

Approach

Each of the three library .csproj files now declares <TargetFrameworks>net8.0;net10.0</TargetFrameworks>. The viewer, console, benchmarks, and unit-test projects are intentionally left as net10.0 only, since the viewer is shipped with its own embedded runtime and the rest are internal consumers.

A source-level audit confirmed the libraries already use only APIs and language features available in .NET 8 (e.g. required/init, ArgumentNullException.ThrowIfNull, System.Buffers.Binary, ImmutableArray). No #if guards, shims, or source changes were needed.

Notes for reviewers

  • <TargetFramework></TargetFramework> is set explicitly in each library csproj to clear the single-TFM default inherited from Directory.Build.props. Without this, the inherited property wins and only net10.0 builds. An alternative would be to make the inherited default conditional, but keeping the override local to the libraries leaves the rest of the repo untouched.
  • Verified locally: full solution builds clean (0 errors), all 418 unit tests pass, and dotnet pack produces packages containing both lib/net8.0/ and lib/net10.0/ (DLL + XML doc) folders.
  • This adds a soft commitment to keep these three projects net8-compatible going forward; reviewers should flag any new use of net9/net10-only APIs in them.

Add net8.0 alongside net10.0 as a target framework for the three
NuGet-published libraries (EncDotNet.Iso8211, EncDotNet.S57, and
EncDotNet.Noaa) to broaden consumer reach to .NET 8 LTS. The
ChartViewer, Console, Benchmarks, and UnitTests projects continue
to target net10.0 only.

The libraries' source already uses only APIs and language features
available in .NET 8, so no source changes or #if guards are required.

TargetFramework is explicitly cleared in each csproj to override the
single-TFM default inherited from Directory.Build.props.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@philliphoff philliphoff merged commit 83a1807 into main Apr 29, 2026
6 checks 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.

1 participant