How to get the version of the executable file?

Salvete! I am writing a vb.net program to update readme files for my applications. I want to extract the version number from other compiled applications. I want to read the version number from the executable, and not from its unrelated resources.

How can I do this in vb.net without using an external tool like reshacker?

(I found this link , but this is for another language.)

+4
source share
1 answer

To do this, you can use this function:

Private Function GetFileVersionInfo(ByVal filename As String) As Version Return Version.Parse(FileVersionInfo.GetVersionInfo(filename).FileVersion) End Function 

Using:

 Debug.WriteLine(GetFileVersionInfo("C:\foo\bar\myapp.exe").ToString) 

Conclusion:

 4.2.9.281 
+10
source

All Articles