获取.NET程序集的AssemblyInformationalVersion价值? [英] Get the .NET assembly's AssemblyInformationalVersion value?

查看:346
本文介绍了获取.NET程序集的AssemblyInformationalVersion价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是获得C#语法大会 AssemblyInformationalVersion 在运行时的属性值?例如:

[总成:AssemblyInformationalVersion(1.2.3.4)]

解决方案

 使用System.Reflection.Assembly
使用System.Diagnostics.FileVersionInfo

// ...

公共字符串GetInformationalVersion(议会大会){
    返回FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;
}
 

What is the C# syntax for getting the assembly's AssemblyInformationalVersion attribute value at runtime? Example:

[assembly: AssemblyInformationalVersion("1.2.3.4")]

解决方案

using System.Reflection.Assembly  
using System.Diagnostics.FileVersionInfo

// ...

public string GetInformationalVersion(Assembly assembly) {
    return FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;
}

这篇关于获取.NET程序集的AssemblyInformationalVersion价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆