Skip to content

Help output for dotnet build appears misleading #52770

Open

Description

@KathleenDollard

Describe the bug

The output of dotnet build -h includes:

  dotnet build [<PROJECT | SOLUTION | FILE>...] [options]

According to the Posix Utility Standard #9, the ellipses would indicate that multiple Projects, etc. could be used. It is not legal to use multiple projects, and I assume not legal to use multiple solutions, and the text indicates you can only use one C# file (file based apps).

If there is a reason an array of strings is accepted, and this declaration is created via System.CommandLine, it may be difficult to remove the ellipses. Thus, I suggest the text be reconsidered, such as frequent use of the phrase "a single", as the current phrasing is not clear that only one is allowed:

The project or solution or C# (file-based program) file to operate on. If a file is not specified, the                               command will search the current directory for a project or solution. 

Activity

  1. added
    untriaged
    on Feb 2, 2026
  2. jjonescz commented on Feb 3, 2026

    @jjonescz
    Member

    If there is a reason an array of strings is accepted

    Yes, the project/solution/file argument name is actually a misnomer - in reality it's a list of any unrecognized arguments and it's just passed down to msbuild.

  3. KathleenDollard commented on Feb 4, 2026

    @KathleenDollard
    Author

    Interesting. I see that now:

    MSBUILD : error MSB1008: Only one project can be specified.
    

    Perhaps you or @Baronfels or @gewarren could improve the help text for the argument to make it clear that only one is allowed, unless replacing the syntax declaration is reasonable.

  4. baronfel commented on Feb 4, 2026

    @baronfel
    Member

    Commands that drive the build are especially frustrating from a help/UX perspective because we can't/don't want to model the entire MSBuild command line, and the MSBuild command line implicitly tries to discover a build-able thing in the CWD. We've kinda kept the dotnet CLI out of the business of replicating that probing in the name of having a single source of truth for what that logic actually is.

    We could get a bit more crisp here if we took the time to actually model the (optional) buildable thing argument and use it across the codebase. It's just annoying because the file-based app buildable thing has different semantics from the msbuild buildable thing - for file-based apps it must be the first non-binlog argument, but MSbuild will happily accept a sln/slnx/slnf/*proj at any position in the arguments array.

    Maybe the correct modeling would be something like

    • optional argument for a 'file based app' that looks for *.cs input with arity exactlyOne. has a custom parser that rejects all other tokens and is positionally 'first' on the build command(s)
      • this can have a more explicit arg name/help description that talks about file-based apps
    • optional argument for 'msbuild buildable thing' that has arity exactlyOne, with a custom arg parser that accepts any sln/slnx/slnf/*proj
      • this argument will do a default value parser that will do CWD probing/validation similar to what MSbuild does - prefer sln/slnx/slnf over projects in the same working directory, and error if there are more than 1 entry in either category (solution vs project)
      • this can have a more explicit arg name/help description that talks about projects and solutions
    • final catch-all argument for the remaining msbuild arguments
      • this can have a more explicit arg name/help that mentions msbuild arguments and links to the learn docs for the MSBuild CLI interface
  5. added this to the Backlog milestone on Feb 10, 2026
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-CLIuntriaged

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions