Particular/GitVersion — pull request #282 by asbjornu (2014-10-24 09:43:10+00:00)
Title: Always set exit code

When `GitVersion.exe´ is passed invalid arguments, it just outputs the help screen and returns 0 as its exit code. This just caused mayhem in a TeamCity build I tested out GitVersion in, because the whole build executed from start to finish without any step failing. Not even the NuGet Pack step failed, even though it used `%system.GitVersion.FullSemVer%` (which was just an empty string). You might blame JetBrains for this; the NuGet Pack build step should fail if its "Version" input is set to a variable and that variable returns null.

This PR fixes this problem by refactoring the `Program` class a bit so it invokes a `Run()` method that always returns an exit code and then always sets that exit code with `Environment.Exit(exitCode)`.

I've also added a test that verifies the exit code in case of invalid arguments, which necessitated a little refactoring of the `GitVersionHelper` class.

PS: This PR also includes #280.