Skip to content

Dotnetup: add env command to update PathPreference mode#54545

Draft
dsplaisted wants to merge 3 commits into
dotnet:release/dnupfrom
dsplaisted:feature/dotnetup-path-mode
Draft

Dotnetup: add env command to update PathPreference mode#54545
dsplaisted wants to merge 3 commits into
dotnet:release/dnupfrom
dsplaisted:feature/dotnetup-path-mode

Conversation

@dsplaisted
Copy link
Copy Markdown
Member

Currently, this PR includes the changes from #54520 but adds a design doc for how to address #53742.

Implementation will be added later, probably to this PR.

Basically, this replaces the defaultinstall command with an env command.

Proposal

Replace dotnetup defaultinstall <user|system> with a noun-verb env command family
backed by a renamed three-value PathPreference enum:

dotnetup env set <none|shell|all>   # persist mode in config and apply
dotnetup env show                   # display current mode; if applied state has
                                    # drifted from the configured mode, report that
                                    # too
dotnetup env script                 # print a shell-specific script that exports
                                    # PATH/DOTNET_ROOT for the current dotnet
                                    # install (formerly `dotnetup print-env-script`)

env set is idempotent — running it again with the same mode is a no-op (and is also
how you re-sync after something else has clobbered your PATH; see the key scenario
below).

Modes:

  • none — Don't modify your environment; use dotnetup dotnet to invoke.
  • shell — Wire dotnetup into your shell's profile file (only shells that load
    profiles see the user dotnet).
  • all — Wire dotnetup into your shell profile and your user-level
    PATH/DOTNET_ROOT so cmd.exe, IDEs, and shortcuts also see it.

See the design doc for more.

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