Robust and friendly command line tools for .NET?

Also from codePlex, the CommandLine project seems to meet your requirements. A Liberal application of copy/paste from the projects home page gives ...

The Command Line Parser Library offers to CLR applications a simple programming interface for manipulating command line input. This library allows you to display an help screen with a good degree of customization. The API keeps on its shoulders everything boring to code.

The Command Parser Library supports:

  • Short options (-s, for example)

    • Option+Value/No space: -sHello
    • Option+Space+Value: -s Hello
  • Short options like switches; no value required

    • Option+Space+Option+....... -s -x -y -z
    • Option+Option+Option+...: -sxyz...
    • Option+Option+Space/Any Comb.: -sx -yz
  • Long options (--long, for example)

    • Option+Equal+Value: --long=Hello
    • Option+Space+Value: --long Hello
  • Composed options (its about values)

    • any 1;2;3;4 (separator is configurable)

Common features

Both accepts values with spaces: -s"Hello World!" --long "Hello CLR!"


You should check out Mono.Options (http://www.ndesk.org/Options) since it is a lot more cross-platform friendly and used extensively in Mono itself.


From CodePlex, ConsoleFX seems to meet your requirements. A Liberal application of copy/paste from the projects home page gives ...

ConsoleFx is an attribute-based .NET/Mono framework for easily developing command-line interface (CLI) applications. It automates most of the work involved in creating a CLI application, like command line argument parsing, error handling and validations, all through the use of attributes. With ConsoleFx, you can say goodbye to lengthy cumbersome code to parse your command-line arguments.

Using the ConsoleFx commandline parser, you can declaratively specify a whole host of conditions for specifying command line arguments. These can include the ability to:

  • Enforce the order of the command line arguments
  • Specify switch options and limit the number of times they can occur as command-line arguments
  • Allow parameters to be specified for switch options, and limit the number of parameters that can be specified
  • Specify non-switch arguuments and how they are to be used
  • Run custom validations on switch parameters and non-switch arguments, including tests for regular expressions, file masks, integers, booleans, enums, etc.
  • Automatically map non-switch arguments to strong-typed properties for easier readability
  • Perform custom validations that can not be performed by ConsoleFx declaratively

ConsoleFx also provides utility classes for console output capturing and extensions to the Console class. We plan to add other utility classes in the future, making it the all-in-one solution for creating your command-line applications.