Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify MajorRevision of .NET Assembly?

Currently, I am using AssemblyVersionAttribute to specify assembly versions of compiled assemblies. However, AssemblyVersionAttribute allows to specify only 16bit revision [1]. How can I specify MajorRevision greater than zero?

like image 944
TN. Avatar asked Dec 11 '25 02:12

TN.


1 Answers

The MajorRevision and MinorRevision properties of the Version class are calculated from the Revision property, as Revision >> 16 and Revision & 0xffff respectively (try opening mscorlib in Reflector).

Assembly versioning does not support revision numbers greater than 16 bits in length. This data is stored in a 16 bit section of the assembly binary. In other words, assembly versions support only a subset of the capabilities of the Version class. You can see this in a hex editor: setting the version to, say, 1.0.0.65534, will give the hex bytes in the compiled DLL 0100 0000 0000 feff. Trying to insert a value in the following two bytes and then inspecting the assembly does not increase the version number beyond 16 bits.

like image 148
David M Avatar answered Dec 15 '25 05:12

David M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!