Skip to content

Drop net6.0 and net7.0 TFMs, keep net8.0+ and netstandard2.x#5387

Merged
thomhurst merged 1 commit intomainfrom
drop-net6-net7-tfms
Apr 4, 2026
Merged

Drop net6.0 and net7.0 TFMs, keep net8.0+ and netstandard2.x#5387
thomhurst merged 1 commit intomainfrom
drop-net6-net7-tfms

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

@thomhurst thomhurst commented Apr 4, 2026

Summary

  • Remove net6.0 from TargetFrameworks in TUnit.TestProject.Library and TUnit.NugetTester csproj files
  • Update all 139 #if NET6_0_OR_GREATER and #if NET7_0_OR_GREATER preprocessor directives to #if NET8_0_OR_GREATER across 67 files
  • .NET Framework users are unaffected (covered by netstandard2.0 targets)

Both net6.0 (Nov 2024) and net7.0 (May 2024) are out of support. The library projects already target netstandard2.0;net8.0;net9.0;net10.0 — this change aligns the preprocessor directives and test projects with that reality.

Closes #4786

Test plan

  • Solution builds with 0 errors
  • CI passes across all target frameworks (net8.0, net9.0, net10.0, netstandard2.0, net472)

Both net6.0 (Nov 2024) and net7.0 (May 2024) are out of support.
Remove net6.0 from TargetFrameworks in test/nuget-tester projects
and update all #if NET6_0_OR_GREATER / NET7_0_OR_GREATER preprocessor
directives to NET8_0_OR_GREATER across 67 files.

.NET Framework users are unaffected (covered by netstandard targets).

Closes #4786
Copy link
Copy Markdown
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Code Review: Drop net6.0 and net7.0 TFMs

This is a clean, well-scoped maintenance PR. Both .NET 6 (EOL Nov 2024) and .NET 7 (EOL May 2024) are out of support, and aligning the preprocessor guards with the actual supported TFMs is the right call.

What's done well

  • Mechanically correct: All 74 preprocessor directive changes (71× NET6_0_OR_GREATER + 3× NET7_0_OR_GREATER) are consistently updated to NET8_0_OR_GREATER, which matches the minimum specific TFM now supported.
  • No functionality lost: Since net8, net9, net10 all satisfy NET8_0_OR_GREATER, all previously-guarded code (DateOnly/TimeOnly, Parallel.ForEachAsync, Task.IsCompletedSuccessfully, generic math, static abstract members, etc.) continues to compile and run for all supported consumers.
  • Correct project file cleanup: TUnit.TestProject.Library and TUnit.NugetTester have their net6.0 targets removed; the main library projects already target netstandard2.0;net8.0;net9.0;net10.0, so no change needed there.
  • netstandard2.0 users are unaffected: The netstandard2.0 target never defined these symbols, so the fallback code paths remain unchanged.

Minor observations (no action required)

  • Feature-to-guard accuracy: A few of the original NET6_0_OR_GREATER guards were slightly conservative for their feature (e.g., Task.IsCompletedSuccessfully is available since .NET 5 / netstandard2.1, and BigInteger.IsPowerOfTwo predates .NET 6 entirely). Since the project doesn't target netstandard2.1 or net5, this was already moot before the PR and remains moot after — the new NET8_0_OR_GREATER guards are perfectly correct for the current TFM matrix.

  • NET7_0_OR_GREATERNET8_0_OR_GREATER: The three cases here (MatrixRangeAttribute<T> using INumber<T> generic math, StaticAbstractMemberTests.cs, and MatrixTests.cs) all require features introduced in .NET 7 / C# 11. With .NET 7 dropped, NET8_0_OR_GREATER is the correct minimum guard.

Verdict

Approved. The change is straightforward, correct, and a sensible step in keeping the project aligned with the supported .NET release cadence. Nothing to block on.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@thomhurst thomhurst enabled auto-merge (squash) April 4, 2026 20:04
@thomhurst thomhurst merged commit b9f6286 into main Apr 4, 2026
15 checks passed
@thomhurst thomhurst deleted the drop-net6-net7-tfms branch April 4, 2026 20:34
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.

Drop net6.0 and net7.0 TFMs, keep net8.0+ and netstandard2.x

1 participant