c# 如何打印 AssemblyFileVersion

标签 c#

如何在我的日志中打印正在运行的程序的版本? 换句话说,我可以使用 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/

相关文章:

c# - 检查变量何时等于另一个值的更好方法

c# - WPF 窗口关闭事件用法

c# - WebRequest.GetResponse 需要很长时间,除非 DefaultWebProxy 为空

c# - 通用类型约束检查

c# - 生成多个随机数

c# - 如何在C#字符串中替换其他字符而忽略其他字符?

c# - 循环遍历标志枚举,同时忽略组合类型

c# - 从 Parse.com 获取所有对象 C# (Unity)

c# - 为什么使用标志+位掩码而不是一系列 bool 值?

c# - 添加元数据以对客户进行 strip 化