Carl Nolan’s ramblings on development
If you are like me and often use console applications for a variety of purposes you would have found the F# template not much use (in fact a blank code file). As such I decided to put together a more complete Project Template that I could use.
The template can be found on the Visual Studio Gallery:
When the template is installed you get the following template added to your F# folder when creating a new F# project:
The Project Template creates a Windows Console Application with the following components:
The application entry point is quite simple:
The custom console application handles the argument parsing, in addition to providing a TODO for the custom code:
If one does not wish to use the argument parsing module the ArgInfo list can be removed. This list provides a simple means for ensuring that the start-up arguments are as expected. The returned parsed parameters is merely a Dictionary of the found arguments.
If one so desires one could map this over to the argument parsing provided by the FSharp PowerPack.
For completeness here is the argument parsing code:
As always, hopefully you will find this template useful.