萨尔维特!我正在编写一个 vb.net 程序来更新我的应用程序的自述文件。我想从其他编译的应用程序中提取版本号。我想从可执行文件中读取版本号,而不是从其未编译的资源中读取版本号。
如何在 vb.net 中执行此操作而不使用像 reshacker 这样的外部工具?
(我发现这个链接 https://stackoverflow.com/questions/3890012/how-to-access-string-resource-from-another-application,但它适用于另一种语言。)
您可以使用这样的函数来做到这一点:
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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)