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:
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 *
.
NET Framework will only load that exact version 11.0.0.0. To load a different version at run time, a binding redirect must be added to the .NET application's config file. Strong naming combined with assembly version enables strict assembly version loading.
Each assembly has two distinct ways of expressing version information: The assembly's version number, which, together with the assembly name and culture information, is part of the assembly's identity. This number is used by the runtime to enforce version policy and plays a key part in the type resolution process at run time.
In .NET Core, assembly loading is more relaxed. The .NET Core runtime automatically loads assemblies with a higher version at run time. ✔️ CONSIDER only including a major version in the AssemblyVersion. e.g. Library 1.0 and Library 1.0.1 both have an AssemblyVersion of 1.0.0.0, while Library 2.0 has AssemblyVersion of 2.0.0.0.
All versioning of assemblies that use the common language runtime is done at the assembly level. The specific version of an assembly and the versions of dependent assemblies are recorded in the assembly's manifest.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With