How to get the AssemblyVersion of a .Net file in Linux
Try to match version numbers that span a whole line:
$ strings file.exe | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'
In my (few) tests, the AssemblyVersion
of the binary was always the last result.
As recommended by Jb Evain you can use the Mono Disassembler.
monodis --assembly file.exe | grep Version
The ikdasm
tool that is also distributed with Mono is more robust than monodis
, which unfortunately crashes with the message "Segmentation fault: 11" on many DLL files. The maintainers explicitly recommend the use of ikdasm
rather than monodis
: https://github.com/mono/mono/issues/8900#issuecomment-428392112
Usage example (with an assembly that monodis
currently cannot handle):
ikdasm -assembly System.Runtime.InteropServices.RuntimeInformation.dll | grep Version: