Skip to content

[release/11.0.1xx-preview7] Honor Configuration environment variable in CLI options - #55452

Merged
Evangelink merged 3 commits into
release/11.0.1xx-preview7from
backport/pr-55431-to-release/11.0.1xx-preview7
Jul 24, 2026
Merged

[release/11.0.1xx-preview7] Honor Configuration environment variable in CLI options#55452
Evangelink merged 3 commits into
release/11.0.1xx-preview7from
backport/pr-55431-to-release/11.0.1xx-preview7

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport of #55431 to release/11.0.1xx-preview7

/cc @Evangelink

Evangelink and others added 3 commits July 24, 2026 11:33
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 72bf4a4e-15d3-4177-9246-c49ad3071b13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 72bf4a4e-15d3-4177-9246-c49ad3071b13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 72bf4a4e-15d3-4177-9246-c49ad3071b13
@github-actions
github-actions Bot requested a review from a team as a code owner July 24, 2026 11:33
@github-actions github-actions Bot added the backport PR that has been backported to a servicing branch label Jul 24, 2026
@github-actions
github-actions Bot requested a review from a team as a code owner July 24, 2026 11:33
@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.

IsDynamic = true,
DefaultValueFactory = _ =>
{
string? configuration = Environment.GetEnvironmentVariable("Configuration");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if I have the following setup?

  1. Configuration env variable set to Release.
  2. Solution with two projects:
    • ProjectA: Typical project like the template console app.
    • ProjectB: It has explicit <Configuration>Debug</Configuration>

Are we introducing a behavior change for ProjectB before vs after this change?

@baronfel baronfel Jul 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

B never used Configuration in that case I believe - the environment variable would already override, because MSBuild read it from the env var.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you both. Resolving the thread

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@baronfel I tested on this csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net11.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <Configuration>Debug</Configuration>
  </PropertyGroup>

</Project>

On current SDK without this PR:

image

It looks like Configuration from csproj is winning (Note that I'm building csproj right away, the behavior is likely to be different when dealing with solution).

The change in this PR will make the same scenario use Release instead of Debug.

@Evangelink

Copy link
Copy Markdown
Member

/ba-g

PR #55452 is a backport that only touches CLI option definitions: CommonOptions.cs, HelpBuilder.cs, and their tests (CliSchemaTests.cs, CommonOptionsTests.cs, a dotnet test options test). It does not touch the file-based-app / run-file feature at all.

The build failed on 2 Helix work items (exit code 2), with these failures:

1. FullFramework windows — It_generates_satellite_assemblies

Console-encoding issue: expected Bienvenue à .Net! but stdout rendered it as Bienvenue ├á .Net!. A code-page/locale artifact on the test agent. Unrelated to the PR.

2. dotnet.Tests windows — 8 failures, all in RunFileTests_BuildOptions

(WorkingDirectory, WorkingDirectory_CscOnly_AfterMSBuild, BinaryLog_EvaluationData_MultiFile, Verbosity_CompilationDiagnostics, MissingShebangWarning ×3, EmbeddedResource)

The error signatures all point to the run-file build cache returning stale/wrong output:

  • expected v2 but got v1 / old content

  • expected MSBuild will be skipped… but got build will be skipped because output is up to date

  • expected warning CA2266 / embedded resource, got plain hello / Resource not found

  • Exit Code: 0 where the test expected a rebuild or failure

This is a test-isolation/caching flakiness pattern in file-based apps, with an established history in the repo (e.g. #54813 "Flaky: RunFileTests_* intermittently fail", #54819, #55057 "handle deleted artifacts directory"). None of it exercises the CLI option code the PR modifies.

@Evangelink
Evangelink merged commit 98e39ca into release/11.0.1xx-preview7 Jul 24, 2026
28 of 30 checks passed
@Evangelink
Evangelink deleted the backport/pr-55431-to-release/11.0.1xx-preview7 branch July 24, 2026 15:54
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved to merge backport PR that has been backported to a servicing branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants