Skip to content

Regression: Explicit configuration value overwritten by environment variable since .NET SDK 11 #57243

Open

Description

@egortech

Describe the bug

dotnet build/publish -p:Configuration=X is ignored when the CONFIGURATION environment variable is set. -c X works; SDK 10.0.404 works.

SDK Command Result
11.0.100 -p:Configuration=Debug, env CONFIGURATION=Release obj/Release ❌ (Expected Debug)
11.0.100 -c Debug, env CONFIGURATION=Release obj/Debug ✔
11.0.100 -p:Configuration=Debug, без env obj/Debug ✔
10.0.404 -p:Configuration=Debug, env CONFIGURATION=Release obj/Debug ✔

Steps to reproduce

dotnet new classlib -f net10.0 -o repro
cd repro
$env:CONFIGURATION = 'Release' 
dotnet build -p:Configuration=Debug

Expected behavior

Release notes states that an explicit command-line option still takes precedence, and empty or whitespace-only environment values are ignored. So -p:Configuration also should take precedence over environment variable.

Actual behavior

Explicit -p:Configuration value overwritten by environment variable.

Is this a regression?

Yes. May also documented as breaking changes if this is desired сhanges.

Are there any workarounds?

Change p:Configuration=X to -c X to keep explicit configuration value X.

dotnet --info output

.NET SDK:
 Version:           11.0.100
 Commit:            297acf930f
 Workload version:  11.0.100-manifests.073a2387
 MSBuild version:   18.12.2-1.26529.118+297acf930

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.28120
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\11.0.100

IDE version

No response

Other details

No response

Activity

  1. added
    untriaged
    on Nov 20, 2026
  2. locked and limited conversation to collaborators on Nov 20, 2026
  3. unlocked this conversation on Nov 20, 2026
  4. added
    breaking-change
    needs team triage
    and removed
    untriaged
    on Nov 20, 2026
  5. github-actions commented on Nov 20, 2026

    @github-actions
    Contributor

    🎯 Agentic Issue Triage

    Triage Assessment:

    • 🏷️ Labels: Area-CLI Bug breaking-change Using this label will notify dotnet/compat and trigger a request to file a compat bug needs team triage Requires a full team discussion
    • 💻 Assignment: none | @dotnet/dotnet-cli
    • 🟨 Confidence: medium - Area is the strongest interpretation, but no CODEOWNERS section matches Area-CLI; MSBuild-level handling is plausible.

    Similar issues: #52358 (potentially related)

    ➡️ Summary: In SDK 11.0.100, -p:Configuration=Debug is overridden by a CONFIGURATION environment variable, unlike 10.0.404 and -c. Investigate the environment-variable handling change and decide whether to fix or document it.

    Generated by 🏷️ Issue Triage for #57243 · copilot · auto (Claude Sonnet 5.5) · ~16 AIC · ⌖ ~2 AIC · ⊞ 15.5K · ◷

  6. dotnet-policy-service commented on Nov 20, 2026

    @dotnet-policy-service
    Contributor
  7. marcpopMSFT commented on Nov 24, 2026

    @marcpopMSFT
    Member

    @dotnet/kitten @baronfel what is the expected behavior here? Should the CLI command override the environment variable?

  8. OvesN commented on Nov 25, 2026

    @OvesN
    Contributor

    @marcpopMSFT Yes, expected behavior here is that CLI command overrides the env variable, as stated in docs.

  9. OvesN commented on Nov 25, 2026

    @OvesN
    Contributor

    As I can see possible culprit is #55431, the intention was to use the Configuration environment variable as the default value of the -c/--configuration option, but I think this override of -p:Configuration=Debug was not intentional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CLIBugbreaking-changeneeds team triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions