Command line parsing was the first task performed by most applications back in the 80’s and even today it is very important. Yet after all these years there isn’t a standard parser available .NET, leaving developers to reinvent this common pattern over and over again.
In the current CTP, it appeared as thought .NET 4 would include a command line parser. We were going to report on this and the comparison to Mono’s API for the same task, but it turns out it was mistakenly released.
We are not shipping System.Shell.CommandLine in .NET 4. This was based on an intern project from a couple of years back that was mistakenly public in the .NET Framework 4.0 CTP. It wasn't a design that we were happy with and has been removed and will not be present in the next preview release.
We have a *much better* command line parsing API, along the lines of Mono.Options, that we're planning to release on CodePlex later this year.
.
Community comments
Isn't that true of any engineering task?
by peter lin,
NConsoler - command line parser
by Maxm Tihobrazov,
Backward compatibility
by .Net developer,
Isn't that true of any engineering task?
by peter lin,
Your message is awaiting moderation. Thank you for participating in the discussion.
I just might be jaded, but any time a engineering task is given to someone that doesn't care for it, or doesn't have a good understanding, it ends up being a pile of over engineered junk. There's plenty of examples out there in closed source and open source projects. If the default MS provided tool doesn't fit the task, then use something else!
NConsoler - command line parser
by Maxm Tihobrazov,
Your message is awaiting moderation. Thank you for participating in the discussion.
You can use it as simple as:
public static void Main(string[] args) {
Consolery.Run(typeof(Program), args);
}
[Action]
public static void DoWork(
[Required] string name,
[Optional(-1)] int count) {
// ...
}
C:\>program.exe Administrator /count:10
Backward compatibility
by .Net developer,
Your message is awaiting moderation. Thank you for participating in the discussion.
Well, what about backward compatibility? should not the .net framework be compatible with its previous versions?
I hope there is an other way to do the same tasks provided by the framework for the sake of compatibility, please.