Skip to content

Don't let dotnet CLI disable MSBUILDUSESERVER - #54918

Merged
AR-May merged 1 commit into
dotnet:mainfrom
AR-May:fix-msbuild-server-env-var
Jun 22, 2026
Merged

AR-May merged 1 commit into
dotnet:mainfrom
AR-May:fix-msbuild-server-env-var

Conversation

@AR-May

@AR-May AR-May commented Jun 22, 2026

Copy link
Copy Markdown
Member

Don't let dotnet CLI disable MSBUILDUSESERVER when DOTNET_CLI_USE_MSBUILD_SERVER is unset

Previously the CLI unconditionally wrote MSBUILDUSESERVER to "1" or "0" based solely on DOTNET_CLI_USE_MSBUILD_SERVER. When that variable was unset (the default), the host wrote MSBUILDUSESERVER=0, clobbering any value the user had set directly via MSBUILDUSESERVER and forcing the MSBuild server off.

Now the CLI only sets MSBUILDUSESERVER=1 when DOTNET_CLI_USE_MSBUILD_SERVER opts in, and otherwise leaves the variable untouched. This lets either variable toggle the MSBuild server on, so a user-provided MSBUILDUSESERVER=1 is honored.

…UILD_SERVER is unset

Previously the CLI unconditionally wrote MSBUILDUSESERVER to "1" or "0" based
solely on DOTNET_CLI_USE_MSBUILD_SERVER. When that variable was unset (the
default), the host wrote MSBUILDUSESERVER=0, clobbering any value the user had
set directly via MSBUILDUSESERVER and forcing the MSBuild server off.

Now the CLI only sets MSBUILDUSESERVER=1 when DOTNET_CLI_USE_MSBUILD_SERVER opts
in, and otherwise leaves the variable untouched. This lets either variable toggle
the MSBuild server on, so a user-provided MSBUILDUSESERVER=1 is honored.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 22, 2026 12:28

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 updates the dotnet CLI’s MSBuild forwarding behavior so it no longer disables the MSBuild server by overwriting MSBUILDUSESERVER=0 when DOTNET_CLI_USE_MSBUILD_SERVER is not set, thereby honoring a user-provided MSBUILDUSESERVER value.

Changes:

  • Stop unconditionally setting MSBUILDUSESERVER to "0" when DOTNET_CLI_USE_MSBUILD_SERVER is unset/false.
  • Only set MSBUILDUSESERVER=1 when DOTNET_CLI_USE_MSBUILD_SERVER opts in.

@AR-May
AR-May merged commit 51aca17 into dotnet:main Jun 22, 2026
26 checks passed
@AR-May

AR-May commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

/backport to release/10.0.4xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.4xx (link to workflow run)

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.

4 participants