Is there any way to obtain the AssemblyVersion of a .Net executable in Linux without using mono? What I am trying to have is a script or command that will let me obtain the AssemblyVersion on Linux boxes. I tried:
#strings file.exe | grep AssemblyVersion
but it only the string and not the number. Also checked with:#file file.exe
but only got general information. Any ideas?
I can get the Assembly Version with the following line of code: Version version = Assembly. GetEntryAssembly(). GetName().
You can get file version of file using PowerShell Get-Command cmdlet. In the above command, Get-Command get dll assembly file version of the specified file using FileVersionInfo. FileVersion property.
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.
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