Skip to content

C# command line parser?

Sat down to start a little command-line app on the weekend – anyone know of a good library to parse command line arguments? Expecting something with a simple api to set up a list of arguments, specific mandatory ones, and enforce some validation (types and ranges?).

Quick Google search came up with:

Expect an update (and the finished project) soon! 🙂

{ 4 } Comments

  1. Craig Dunn | August 15, 2007 at 11:56 pm | Permalink

    The Mono.GetOptions library (which has been updated with a VisualStudio project file in Searcharoo) is a nice, declarative way of specifying command line arguments using Attributes.

  2. Maxim Tihobrazov | September 8, 2008 at 5:30 pm | Permalink

    NConsoler is an open source library that provides command line parser functionality based on attribute metadata attached to type.
    Library is very easy to add and use in your application. NConsoler gives an ability to display help and validation messages without any line of code.

    Example code:

    using System;
    using NConsoler;

    public class Program {
    public static void Main(params string[] args) {
    Consolery.Run(typeof(Program), args);

    public static void Method(
    [Required] string name,
    [Optional(true)] bool flag) {
    Console.WriteLine(“name: {0}, flag: {1}”, name, flag);

    and use it:

    program.exe “Maxim” /-flag

  3. Anonymous | April 17, 2009 at 9:16 pm | Permalink


    There is a command line parser that is available on codeplex in the CommonLibrary.NET library.
    ( Similar to Java Commons ). does :
    1. required / optional args
    2. default values for args
    3. substitutions ${today}
    4. Applies arg values to an object
    5. Uses attributes

  4. rnaga | February 7, 2012 at 3:59 pm | Permalink

    There is another simple and elegant implementation of command line arguments at

    Please check it out. I’ve tried it in couple of projects, works very well.

Post a Comment

Your email is never published nor shared. Required fields are marked *