.net 产品版本号

.net 产品版本号,.net,version,.net,Version,我想检索exe的产品版本号。 如果可能的话,我需要一些可以从命令行工作的东西 还有unix的实用程序吗?我在mac和pc上都需要这个 提前谢谢 Gaur系统.反射.汇编.GetExecutionGassembly().GetName().Version.ToString() 或 或者通过读取EXE的PE头可能是最好的选择: 系统.Reflection.Assembly.GetExecutionGassembly().GetName().Version.ToString() 或 或者通过读取EXE

我想检索exe的产品版本号。 如果可能的话,我需要一些可以从命令行工作的东西

还有unix的实用程序吗?我在mac和pc上都需要这个

提前谢谢


Gaur

系统.反射.汇编.GetExecutionGassembly().GetName().Version.ToString()

或者通过读取EXE的PE头可能是最好的选择:


系统.Reflection.Assembly.GetExecutionGassembly().GetName().Version.ToString()

或者通过读取EXE的PE头可能是最好的选择:

using System.Diagnostics;
...

public void GetFileVersion()
{
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(@"C:\A.exe");

// Print the file name and version number.
String text = "File: " + myFileVersionInfo.FileDescription + '\n' +
"Version number: " + myFileVersionInfo.FileVersion;
Console.WriteLine(text);
}