This is a heavily modified fork of the corresponding task in the MSBuild Versioning project . This was necessary because we use TeamCity as our build server. TeamCity checks out the source code without the '.git' folder, which would lead to an exception. Therefore a different exception handling implementation was necessary.