如何在我的日志中打印正在运行的程序的版本? 换句话说,我可以使用 Console.WriteLine 访问 AssemblyFileVersion 吗?
谢谢 托尼
最佳答案
看起来像这样的东西会起作用:
public static string Version
{
get
{
Assembly asm = Assembly.GetExecutingAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
return String.Format("{0}.{1}", fvi.ProductMajorPart, fvi.ProductMinorPart);
}
}
来自 another post on SO .
关于c# 如何打印 AssemblyFileVersion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3400950/