Honor Configuration environment variable in CLI options#55431
Open
Evangelink wants to merge 3 commits into
Open
Honor Configuration environment variable in CLI options#55431Evangelink wants to merge 3 commits into
Evangelink wants to merge 3 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 72bf4a4e-15d3-4177-9246-c49ad3071b13
|
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. |
Evangelink
enabled auto-merge
July 23, 2026 14:23
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores/extends CLI behavior so the shared -c/--configuration option can default from the Configuration environment variable (addressing the regression reported in #52358), while ensuring explicit CLI values and /p:Configuration continue to take precedence.
Changes:
- Seed
--configurationfrom theConfigurationenvironment variable and forward it as--property:Configuration=.... - Preserve precedence when
--property:Configuration=...is explicitly provided (don’t let the implicit env-derived configuration override it). - Add parser-level tests and an end-to-end
dotnet testregression test for solution execution.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet.Tests/ParserTests/CommonOptionsTests.cs | Adds parser tests validating env-defaulting and precedence rules for configuration forwarding. |
| test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs | Adds an end-to-end regression test asserting dotnet test honors Configuration env var when --configuration is not passed. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/Common/CommonOptions.cs | Implements env-based defaulting for --configuration and adds forwarding logic to avoid overriding explicit /p:Configuration. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
baronfel
reviewed
Jul 23, 2026
5 tasks
baronfel
requested changes
Jul 23, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 72bf4a4e-15d3-4177-9246-c49ad3071b13
baronfel
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the
Configurationenvironment-variable regression in #52358.Summary
-c/--configurationoption from theConfigurationenvironment variable--configurationvalueThis follows the approach suggested in the issue discussion and applies consistently to commands using the shared configuration option. A standalone
Platformenvironment variable remains outside this change because there is no equivalent shared CLI option.Validation
build.cmddotnet.Teststests coveringCommonOptionsTestsand the MTP solution regression scenario