Skip to content

Allow re-ordering of host commands to print data (--list-runtimes, --list-sdks, --info, --help) and other options #116225

Open
@elinor-fung

Description

@elinor-fung

Currently, the dotnet commands for printing data (--info, --help, --list-runtimes, --list-sdks) are required to be the first argument. With https://github.com/dotnet/runtime/pull/1160780, an --arch option is now available for --list-runtimes/sdks - and must come after the data printing command. The host has a number of other options intended for running an application:

{ _X("--additionalprobingpath"), _X("<path>"), _X("Path containing probing policy and assemblies to probe for.") },
{ _X("--depsfile"), _X("<path>"), _X("Path to <application>.deps.json file.") },
{ _X("--runtimeconfig"), _X("<path>"), _X("Path to <application>.runtimeconfig.json file.") },
{ _X("--fx-version"), _X("<version>"), _X("Version of the installed Shared Framework to use to run the application.") },
{ _X("--roll-forward"), _X("<value>"), _X("Roll forward to framework version (LatestPatch, Minor, LatestMinor, Major, LatestMajor, Disable)") },
{ _X("--additional-deps"), _X("<path>"), _X("Path to additional deps.json file.") },
{ _X("--roll-forward-on-no-candidate-fx"), _X("<n>"), _X("<obsolete>") }

If any are specified before a data printing command, the data printing command is not recognized and the operation fails.

This is inconsistent with how such commands are typically handled, where they can appear in any order and specified with other options - where those options may not actually apply and printing data overrides other options.

See #116078 (comment)

We should consider relaxing this ordering requirement to be consistent with other command line behaviour.

Some considerations:

  • --list-runtimes/sdks is used as an indication that it is only for host data and the SDK does not need to be resolved or run. It should remain that way.
  • --info and --help call into the SDK when it exists - which will error out on unknown options. We'll need to skip the other known host options when calling into the SDK
  • Any unknown option coming before a printing command should still go to the SDK - for example dotnet <unknown_option> --list-runtimes should still call into the SDK

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions