Skip to content

.NET: Improve local release build perf by only formatting for one build target framework#5266

Open
westey-m wants to merge 2 commits intomicrosoft:mainfrom
westey-m:local-format-perf-improve
Open

.NET: Improve local release build perf by only formatting for one build target framework#5266
westey-m wants to merge 2 commits intomicrosoft:mainfrom
westey-m:local-format-perf-improve

Conversation

@westey-m
Copy link
Copy Markdown
Contributor

Motivation and Context

Currently when doing a release build locally, it runs dotnet format (target framework count) squared times, since it runs dotnet format for each target framework as part of the overall build, but dotnet format already formats for each target framework anyway.

All this only applies when run locally. This file does not apply when running on the build server, which already does this correctly.

Description

  • Restricting dotnet format to only run for .net 10 builds.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings April 15, 2026 09:08
Copy link
Copy Markdown
Contributor

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

Note

Copilot was unable to run its full agentic suite in this review.

Speeds up local Release builds by preventing dotnet format from running repeatedly for each target framework (while still skipping on GitHub Actions).

Changes:

  • Updates the DotnetFormatOnBuild MSBuild target condition to only run on local Release builds for net10.0.
  • Expands inline documentation to explain why formatting is restricted to a single TFM.

Comment thread dotnet/Directory.Build.targets Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@moonbox3 moonbox3 added the .NET label Apr 15, 2026
@github-actions github-actions bot changed the title Improve local release build perf by only formatting for one build target framework .NET: Improve local release build perf by only formatting for one build target framework Apr 15, 2026
@westey-m westey-m enabled auto-merge April 15, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants