Skip to content

GH5169: Make environment-defaulted DotNet switches tri-state - #5170

Merged
devlead merged 1 commit into
cake-build:developfrom
devlead:feature/gh-5169
Oct 27, 2026
Merged

devlead merged 1 commit into
cake-build:developfrom
devlead:feature/gh-5169

Conversation

@devlead

@devlead devlead commented Oct 27, 2026

Copy link
Copy Markdown
Member
  • Add ProcessArgumentBuilder AppendSwitch(string, bool?) and AppendSwitch(string, string, bool?) extensions. null emits nothing so the .NET CLI default applies, and true/false emit --switch true/--switch false.
  • Change these settings from bool to bool? so the environment-derived default (for example --interactive is [default: True] in an interactive terminal) can be explicitly opted out of:
    • DotNetRestoreSettings.Interactive
    • DotNetReferenceAddSettings.Interactive
    • DotNetProjectConvertSettings.Interactive
    • DotNetWorkloadInstallSettings.Interactive
    • DotNetWorkloadRestoreSettings.Interactive
    • DotNetToolInstallSettings.CreateManifestIfNeeded
  • Switches that are flag-only and reject an explicit value (--interactive on tool install/update/restore, package add/list, workload update/repair, nuget delete, plus --nologo) are left as bool.
  • Add unit tests for true, false and null values.

Breaking change: the property type changes from bool to bool?. Assignments still compile, but code that reads the value needs updating.

- Add ProcessArgumentBuilder AppendSwitch(string, bool?) and AppendSwitch(string, string, bool?) extensions, emitting an explicit true or false value and nothing when null.
- Change DotNetRestoreSettings.Interactive, DotNetReferenceAddSettings.Interactive, DotNetProjectConvertSettings.Interactive, DotNetWorkloadInstallSettings.Interactive, DotNetWorkloadRestoreSettings.Interactive and DotNetToolInstallSettings.CreateManifestIfNeeded to bool?, so the environment-derived .NET CLI default can be explicitly opted out of.
- Add unit tests for true, false and null values.
- fixes cake-build#5169
@devlead
devlead merged commit 3aeb08a into cake-build:develop Oct 27, 2026
18 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.

Make environment-defaulted DotNet switches tri-state to allow explicit opt-out

1 participant