Skip to content

Add support for .NET 11 #4998

Description

@arturcic

Summary

Add .NET 11 to GitVersion's supported target frameworks.

.NET 11 is the next Standard Term Support (STS) release, currently in preview, with GA expected November 2026. GitVersion should target it so the CLI/global tool, the MSBuild task, and the Docker images run natively on .NET 11.

Relationship to the framework cleanup

This is additive and complements #4997 (drop .NET 8 / .NET 9). Combined end state:

Before After #4997 After #4997 + this
net8.0;net9.0;net10.0 net10.0 net10.0;net11.0

i.e. the current LTS (.NET 10) plus the latest STS (.NET 11) — mirroring how the project currently pairs an LTS with the newest releases.

Timing: .NET 11 is preview until ~November 2026. Targeting can be staged behind preview SDKs, but the stable bump should land once .NET 11 GAs. Re-milestone if 7.x ships before then.

What needs to change

SDK

  • global.json — bump sdk.version from 10.0.301 to the .NET 11 SDK (11.0.1xx) once available (the SDK targets all earlier runtimes, so this is safe ahead of dropping anything).

Target frameworks

  • src/Directory.Build.props:3 — add net11.0 to <TargetFrameworks> (e.g. net10.0;net11.0, accounting for Drop .NET 8 and .NET 9 target frameworks (end of support 2026-11-10) #4997).
  • src/Directory.Packages.props — add a MicrosoftBuildVersion condition for '$(TargetFramework)' == 'net11.0' (the MSBuild/SDK version that ships with .NET 11), alongside the existing per-TFM entries.

MSBuild task packaging & selection

  • src/GitVersion.MsBuild/GitVersion.MsBuild.csproj — add a tools/net11.0 <None Include=.../> packaging entry mirroring the existing tools/net10.0 one (:44).
  • src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.targets — add a net11.0 GitVersionTargetFramework selection branch consistent with the existing net9/net10 branches.

Build / CI matrix (drives test jobs and Docker images)

  • build/common/Utilities/Constants.cs:10 — add "11.0" to DotnetVersions (e.g. [DotnetLtsLatest, "11.0"]). This single constant feeds the CI unit-test matrix (SetMatrix.cs_prepare.ymlci.yml/_unit_tests.yml) and the Docker image matrix (DockerBuildLifetime.cs). Confirm Docker base images for net11.0 are available before enabling the Docker leg.

Source code

  • No changes expected. The only TFM-conditional code, src/GitVersion.Core/Core/RegexPatterns.cs, gates on #if NET9_0_OR_GREATER, which already includes net11.0 — the partial-property [GeneratedRegex] path applies automatically. (Verify nothing new is needed if .NET 11 deprecates/changes any used API.)

Acceptance criteria

  • dotnet build/dotnet test ./src/GitVersion.slnx pass with net11.0 in the matrix.
  • dotnet format --verify-no-changes ./src/GitVersion.slnx passes.
  • GitVersion.MsBuild smoke-tested against a net11.0 consumer project.
  • Docker images produced for net11.0 (once base images exist).
  • No analyzer/obsolete warnings introduced by the .NET 11 SDK/runtime.
  • Docs / release notes mention .NET 11 support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions