Create Windows Services Easily with Topshelf

Creating a Windows Service is trivial using Topshelf, a freely-available library that converts a console application to a Windows Service. In this article, you’ll create a simple notification app and integrate Topshelf.

Custom Formatters for Timestamps

I came across a particularly aggravating problem today while using a custom Timespan formatter inside the ToString() method override: “Input string was not in a correct format.” The call in question was: So why doesn’t that work? Well if you go to the MSDN page for Custom TimeSpan Format Strings here, you will notice a yellow box at the top of the screen stating that the “TimeSpan format specifiers do not include placeholder seperator symbols”, meaning that we have to put in a backslash to escape the literal we want put in. The string that the ToString override wants is:…