Skip to content

Target net8.0 as minimum TFM for NuGet package#118

Merged
jonathanpeppers merged 6 commits into
mainfrom
jonathanpeppers/nuget-target-net8-0
May 5, 2026
Merged

Target net8.0 as minimum TFM for NuGet package#118
jonathanpeppers merged 6 commits into
mainfrom
jonathanpeppers/nuget-target-net8-0

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Owner

The NuGet package (SortingNetworks.SourceGen) previously targeted netstandard2.0, which made the NuGet page show compatibility with .NET Framework 4.6.1+, .NET Core 2.0+, etc. In practice, the generated code won't compile on anything below net8.0 because it uses APIs introduced in that release (ARM SIMD VectorTableLookup tuple overloads, Vector128.ConditionalSelect, StoreUnsafe).

This PR updates the package TFM to net8.0 so NuGet correctly communicates the real minimum to consumers.

How the minimum was determined:

Built a test project with [SortingNetwork(27, typeof(int))] against progressively lower TFMs:

  • net6.0 -- missing Vector128.ConditionalSelect, StoreUnsafe (175 errors)
  • net7.0 -- missing VectorTableLookup tuple overloads for ARM multi-register intrinsics (65 errors)
  • net8.0 -- builds and all 475 tests pass

Changes:

  • SortingNetworks.csproj: netstandard2.0 -> net8.0 (the NuGet package DLL)
  • Directory.Build.props: net10.0 -> net8.0 (tests + benchmarks now validate against the minimum)
  • Sample project: removed redundant TFM override (inherits net8.0 from Directory.Build.props)
  • Test project: added <RollForward>Major</RollForward> so tests run on newer runtimes (e.g. 9.0/10.0)

The generator project stays at netstandard2.0 -- that's a Roslyn requirement for source generators.

jonathanpeppers and others added 2 commits May 4, 2026 20:05
The generated code uses ARM SIMD VectorTableLookup tuple overloads
(and other APIs) that require net8.0+. The previous netstandard2.0
target was misleading since consumers on older frameworks would get
compile errors from the generated code.

- Change SortingNetworks (NuGet package) from netstandard2.0 to net8.0
- Change Directory.Build.props default from net10.0 to net8.0
- Remove redundant TFM override from sample project

The generator project stays at netstandard2.0 (Roslyn requirement).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers marked this pull request as ready for review May 5, 2026 01:20
Copilot AI review requested due to automatic review settings May 5, 2026 01:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repository and packaged library to treat .NET 8 as the new baseline, aiming to align NuGet/package metadata with the generated code’s actual runtime/API requirements.

Changes:

  • Retargets the SortingNetworks.SourceGen package project from netstandard2.0 to net8.0.
  • Lowers the repo-wide default TFM from net10.0 to net8.0, so tests/benchmarks validate against the proposed minimum.
  • Removes the sample’s explicit TFM override and adds RollForward=Major to the test project.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
SortingNetworks/SortingNetworks.csproj Changes the packaged library target framework to net8.0.
SortingNetworks.Tests/SortingNetworks.Tests.csproj Adds runtime roll-forward for the test app.
samples/SortingNetworks.Sample/SortingNetworks.Sample.csproj Removes the sample’s explicit net10.0 target so it inherits the repo default.
Directory.Build.props Changes the repo-wide default target framework from net10.0 to net8.0.

Comment thread samples/SortingNetworks.Sample/SortingNetworks.Sample.csproj
Comment thread SortingNetworks/SortingNetworks.csproj
Comment thread Directory.Build.props
jonathanpeppers and others added 3 commits May 4, 2026 20:24
Benchmarks should run on the latest runtime for accurate perf numbers.
Only the NuGet package, tests, and sample explicitly target net8.0 to
validate the minimum supported TFM.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
RestoreSources replaces all NuGet sources, preventing the net8.0
runtime host pack from being downloaded from nuget.org.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers force-pushed the jonathanpeppers/nuget-target-net8-0 branch from 69ea136 to 366317a Compare May 5, 2026 01:35
@jonathanpeppers jonathanpeppers merged commit d711948 into main May 5, 2026
6 checks passed
@jonathanpeppers jonathanpeppers deleted the jonathanpeppers/nuget-target-net8-0 branch May 5, 2026 01:49
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.

2 participants