kyrylomyr
kyrylomyr

Reputation: 12632

Reserved max value in the .NET assembly version

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

Upvotes: 6

Views: 3344

Answers (1)

NtFreX
NtFreX

Reputation: 11367

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

Upvotes: 4

Related Questions