Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the AssemblyVersion of a .Net file in Linux

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?

like image 224
Freddy Avatar asked Oct 15 '10 21:10

Freddy


People also ask

How do I get Assemblyversion?

I can get the Assembly Version with the following line of code: Version version = Assembly. GetEntryAssembly(). GetName().

How do I find the PowerShell assembly version?

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.


1 Answers

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.

like image 192
Frédéric Hamidi Avatar answered Sep 23 '22 19:09

Frédéric Hamidi