Why are build numbers limited to 65535?

In my previous post I explained how to fix the issue with the default date format provided in the AssemblyVersionTask. Several people encountered the problem with the arrival of 2007, and all of them sent me mail about it :) After providing them with the fix, a few people wrote back and commented (with variying degrees of politeness) that my code was bad and that I should change it to support a larger build number.

That's a mighty fine suggestion, but unfortunately the limitation isn't in my code, it's imposed by the operating system:

Binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, "FILEVERSION 3,10,0,61" is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if version is defined by the DWORD values dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).

So, I'm sad to say, we will be stuck with 16-bit build numbers forever.

[ Author: Neil Enns ]

Comments

  • Anonymous
    January 06, 2007
    If you use the AssemblyInfoTask to stamp the version numbers for your assemblies that you build with

  • Anonymous
    January 10, 2007
    Sie erzeugen tägliche Builds in VSTS und nutzen den AssemblyInfoTask , um die File und Assembly Build

  • Anonymous
    January 13, 2007
    Great explanation, thanks for the details!

  • Anonymous
    January 16, 2007
    I made a patch for the zip task to canonicalize the working directory path, but I can't seem to get a hold of you guys. Recommendations?

  • Anonymous
    January 16, 2007
    er... is this the community tasks blog, or the msbuild blog?

  • Anonymous
    January 29, 2007
    Mark, this is the msbuild team blog, not the community tasks blog. Neil

  • Anonymous
    March 26, 2007
    Could use YY + ordinal days (days since 1/1) ; such that, March 26, 2007 build would be: 1.0.07084.00

  • Anonymous
    April 23, 2007
    I am terribly sorry guys, but you are all wrong: The highest valid build number is not 65535 (but you were pretty close: it's 65534. But don't ask why, 65535 throws an exception, 65534 does not...)

  • Anonymous
    August 24, 2007
    The comment has been removed