Monthly Archives: February 2008

How does automatic versioning in .NET work?

Visual Studio and .NET have a standard way of handling versioning of Assemblies. This is a good thing. You specify the version in the AssemblyVersionAttribute of your AssemblyInfo and the MSIL Assembler (Ilasm.exe) will take care of it and creates an .exe or .dll file with an embedded version number. .NET will even number your builds automatically! All you have to do is set the AssemblyVersionAttribute to “1.0.*” (instead of setting all values explicitly (e.g. “1.0.0.0”).

But how does the auto numbering actually work? It took me a while to find out, so I thought I will post this for future reference: The version follows the pattern “<MajorVersion>.<MinorVersion>.<BuildNumber>.<Revision>”. The compiler will now generate a build number and a revision number. The build number is the number of days since January 1st 2000. The revision number is the number of seconds from midnight divided by two.

Thinking about this I have some issues with the way how .NET handles versioning:

Calling the third number build number is quite misleading. You would expect the auto numbering mechanism to come up with a unique build number. But it’s only unique if you do one build a day! Guess what: that’s the way the Microsoft processes work: Daily builds. Not surprising if you build software of the size of Windows or Office… However in today’s enterprise software development we often have faster build cycles. Agile development and XP (Extreme Programming) advocate continuous integration. This means every check-in triggers a build. Effectively this means you need both [BuildNumber and Revision] to have a unique build number. This leads us to the next issue:

This scheme lets you only define a two level version. I think that’s not good enough. It is quite common to have a three level version. Lets define the three levels:

Major is a version you would charge a customer to upgrade. The application might look completely different, you have substantial improvements and major new functions.

Minor Version: In general you do not charge customers for an upgrade. A minor version has some new functions and some enhancements. Users will however not see instantly that it is a new version.

Revision: This is a service upgrade that fixes some errors. No new functions are added.

My conclusion (and I’m aware this will be just a wish and never be realized :-) :

Dear Microsoft: Make the Version a five level number (e.g. 1.0.0.0.0). this would allow your current auto versioning to continue (and work in an agile environment) but leaves room for a flexible release policy.