6

I wonder why the assembly version can not have the max UInt16 values. The MSDN states that:

All components of the version must be integers greater than or equal to zero. Metadata restricts the major, minor, build, and revision components for an assembly to a maximum value of UInt16.MaxValue - 1.

Does anyone know what the max value is reserved for?

UPDATE 1

It's not a duplicate question. I'm not asking about the max value of UInt16 itself, that is 65535. I'm asking why the max possible value for version is 65534. I haven't found any explanation about internal usage of the last value and why it is reserved in .NET.

UPDATE 2

People say that max value could be used for *. Yes, it is really possible to set the assembly version to something like 1.0.*. And I did it. And then checked the manifest of the compiled file:

enter image description here

And as you can see, compiler didn't set build and revision to 65535. Instead, it has generated some specific values. So, probably max value is not for *.

3
  • 2
    That's not a duplicate but the accepted answer explains it (probably for the *) Jun 21, 2017 at 15:16
  • 1
    I think they tried to put 65535 in their back-pocket, reserving it to mean "not specified". This was used in the ILMerge.exe utility, and promptly blew up badly. So stay away from it, dragons live there. Jun 21, 2017 at 15:38
  • 2
    See Also: The OP's blog contains a helpful list of restrictions on version numbers.
    – jrh
    Dec 19, 2017 at 15:48

1 Answer 1

4

Why are build numbers limited to 65534?

FILEVERSION

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).

Metadata restricts major, minor, build, and revision to a maximum of UInt16.MaxValue - 1. ref

3
  • 1
    That does not explain why you can't use 65535, which is what the question is about. FILEVERSION has no mention of such a restriction, it simply explains how the numbers are stored. We already know the managed metadata has the restriction, the question was about why. Jun 21, 2017 at 15:41
  • @JeroenMostert Ill clarify what is affected as soon as Im on a computer. And Ive only found references explaining that the last bit is used for metadata. I ve found no mention about what metadata.
    – NtFreX
    Jun 21, 2017 at 15:44
  • 1
    The reference only explains what I've wrote in the question. Nothing says about how .NET or OS uses the max value.
    – kyrylomyr
    Jun 21, 2017 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.