Skip to content

Make DOTNET_CLI_USE_MSBUILD_SERVER=false authoritative opt-out#55393

Merged
JanProvaznik merged 5 commits into
mainfrom
copilot/fix-dotnet-cli-use-msbuild-server
Jul 21, 2026
Merged

Make DOTNET_CLI_USE_MSBUILD_SERVER=false authoritative opt-out#55393
JanProvaznik merged 5 commits into
mainfrom
copilot/fix-dotnet-cli-use-msbuild-server

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

DOTNET_CLI_USE_MSBUILD_SERVER=false previously left MSBUILDUSESERVER unset, allowing /mt, response files, or MSBUILDFORCEMULTITHREADED=1 to implicitly enable the MSBuild server.

  • Server selection

    • Forward MSBUILDUSESERVER=0 when the CLI server setting is disabled.
    • Preserve explicitly configured MSBUILDUSESERVER values.
  • Coverage

    • Cover unset, explicitly enabled, and explicitly disabled MSBUILDUSESERVER cases.
DOTNET_CLI_USE_MSBUILD_SERVER=false
MSBUILDUSESERVER=<unset>
→ MSBUILDUSESERVER=0

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
3 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI and others added 3 commits July 21, 2026 11:45
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix DOTNET_CLI_USE_MSBUILD_SERVER for /mt option Make DOTNET_CLI_USE_MSBUILD_SERVER=false authoritative Jul 21, 2026
Copilot AI requested a review from JanProvaznik July 21, 2026 11:52
@JanProvaznik
JanProvaznik marked this pull request as ready for review July 21, 2026 11:56
@JanProvaznik
JanProvaznik requested a review from a team as a code owner July 21, 2026 11:56
Copilot AI review requested due to automatic review settings July 21, 2026 11:56
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 makes DOTNET_CLI_USE_MSBUILD_SERVER=false an authoritative opt-out by ensuring the CLI forwards an explicit MSBUILDUSESERVER=0 when the user hasn’t explicitly set MSBUILDUSESERVER, preventing implicit server enablement via /mt, response files, or MSBUILDFORCEMULTITHREADED.

Changes:

  • Change MSBuild forwarding to set MSBUILDUSESERVER to 1 or 0 based on DOTNET_CLI_USE_MSBUILD_SERVER when MSBUILDUSESERVER is not already set.
  • Evaluate DOTNET_CLI_USE_MSBUILD_SERVER per forwarding-app instance (not once at type initialization).
  • Add unit tests covering the interaction between DOTNET_CLI_USE_MSBUILD_SERVER and explicit MSBUILDUSESERVER values.

Reviewed changes

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

File Description
src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs Sets MSBUILDUSESERVER based on DOTNET_CLI_USE_MSBUILD_SERVER unless user explicitly sets MSBUILDUSESERVER; evaluates setting per invocation.
test/dotnet.Tests/CommandTests/MSBuild/GivenMsbuildForwardingApp.cs Adds tests validating forwarding behavior for unset/explicit MSBUILDUSESERVER when CLI setting disables the server.

Comment thread test/dotnet.Tests/CommandTests/MSBuild/GivenMsbuildForwardingApp.cs
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
@JanProvaznik JanProvaznik changed the title Make DOTNET_CLI_USE_MSBUILD_SERVER=false authoritative Make DOTNET_CLI_USE_MSBUILD_SERVER=false authoritative opt-out Jul 21, 2026
@JanProvaznik
JanProvaznik merged commit f18ff88 into main Jul 21, 2026
28 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.

DOTNET_CLI_USE_MSBUILD_SERVER=false is not an authoritative opt-out for /mt

4 participants