Useful .NET libraries for console applications

In the past couple of weeks at work I’ve being rewriting a .NET console application that imports data and runs as a schedule task on a server. I’ve had to work on few of these sort of apps as a web developer, so I thought I’d share my knowledge.

These type of applications aren’t particularly exciting to work on for a bunch of reasons. But they’re almost always very critical and are required to run correctly and reliably. Luckily there are some useful libraries that ease the burden.

Here are some that I’ve used in the past couple of weeks.

nLog –

Logging is very important for applications that are run as scheduled tasks because when it fails you need some way of determining why. nLog is very simple to use and rich with features. I’ve set it up to trigger an email on fail and also configured log file archiving.

FileHelpers –

FileHelpers is a brilliant library that simplifies the job of parsing import files. It takes some time to understand how to use initially, but it’s still much less time than writing the parsing code yourself.

DotNetZip –

Sometimes import files will need to be unzipped. DotNetZip seemed like the simplest .NET zip library to use of the bunch. It worked and didn’t require many lines of code to use – can’t beat that.

ndesk.options –

The data importer I was working on required some command line arguments to trigger the various different ways I needed to run it – type of import and different time spans. That’s where a command line argument parser like desk.options comes in handy. The way it works seems a little quirky, but it does the job.