If you use NAnt to manage your build cycle, there’s a great extension called NAntContrib. It has a bunch of extension tasks to help manage your build more easily.
Among them is the awesome
tag, which allows you to automatically increment your version number every build. To add it, simply add into your target:
Run NAnt, and viola! You’re presented with this un-helpful and frustrating error message:
Unable to read version number from "build.number".
Could not find file 'build.number'.
Worse yet, creating an empty
build.number file makes NAnt tell you the format is invalid. And googling reveals nothing.
As it turns out, the enigmatic format required is very simple: it’s a four-part version number typical of .NET assemblies. Simply start off with
126.96.36.199 and your build works. Hooray! Thanks for nothing, NAnt!