How to Get Version of an Executable file?

那年仲夏 提交于 2019-12-10 14:34:39

问题


Salvete! I am writing a vb.net program to update the 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, not from its uncompiled resources.

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

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


回答1:


You can use a function like this to do it:

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

Usage:

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

Output:

4.2.9.281


来源:https://stackoverflow.com/questions/11237684/how-to-get-version-of-an-executable-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!