Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

Plan: Support boolean values for --self-contained flag

Analysis

The issue is that customers pass --self-contained true/false but the CLI currently ignores the false value. The ForwardIfEnabled method only forwards when the boolean is true.

Changes Required

  • Explore codebase and understand current implementation
  • Modify SelfContainedOption in CommonOptions.cs to use ForwardAsMany instead of ForwardIfEnabled to support both true and false values
  • Test manually with dogfood environment - verified all scenarios work
  • Run existing tests to ensure no regressions
  • Add new tests if needed
  • Run code review
  • Run security scan

Implementation Details

  1. ✅ Changed SelfContainedOption to forward both true and false values using ForwardAsMany
  2. ✅ Kept NoSelfContainedOption for backward compatibility with --no-self-contained
  3. ✅ Validation correctly detects conflicts between --self-contained and --no-self-contained options
  4. ✅ Manual testing verified:
    • --self-contained=false → framework-dependent (7 files)
    • --self-contained=true → self-contained (192 files)
    • --self-contained (no value) → self-contained (192 files)
    • --self-contained=true --no-self-contained → error (as expected)
Original prompt

A lot of customers assume that --self-contained is a boolean and they pass true and false to it but today we ignore that boolean. Rather than remove this flag and break people, let's actually support the boolean for this flag. Please make it so that true sets self-contained as it does today but make --self-contained false disable self-contained.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@marcpopMSFT
Copy link
Member

I tested and it works correctly and the code looks right. There are a surprising number of tests that were dependent on this not working which is confusing.

@marcpopMSFT marcpopMSFT marked this pull request as ready for review January 9, 2026 00:45
@marcpopMSFT marcpopMSFT requested a review from baronfel January 9, 2026 00:45
@marcpopMSFT
Copy link
Member

I tested all four possible options:

  1. nothing specified
  2. --self-contained
  3. --self-contained false
  4. --self-contained true

We will set _CommandLineDefinedSelfContained when false now though that seems correct (and we don't appear to use it anywhere). _SelfContainedWasSpecified will now also be true when setting false.

@marcpopMSFT
Copy link
Member

note that before, --self-contained false was a weird grey area as it wouldn't set self-contained (so we were actually taking into account the boolean). This is because ForwardIfEnabled would only set self contained if the value were true (or empty). If false, it wouldn't forward the command from what I can tell. That means it's not as bad as I had assumed but it does mean if you have SelfContained specified elsewhere, the CLI false value won't affect it.

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.

2 participants