本文整理汇总了C#中System.Reflection.Assembly.GetFileVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Assembly.GetFileVersion方法的具体用法?C# Assembly.GetFileVersion怎么用?C# Assembly.GetFileVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Assembly
的用法示例。
在下文中一共展示了Assembly.GetFileVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVersionFromAssembly
private string GetVersionFromAssembly(Assembly assembly) {
if (assembly == null)
return null;
string version = assembly.GetInformationalVersion();
if (String.IsNullOrEmpty(version) || String.Equals(version, "0.0.0.0"))
version = assembly.GetFileVersion();
if (String.IsNullOrEmpty(version) || String.Equals(version, "0.0.0.0"))
version = assembly.GetVersion();
if (String.IsNullOrEmpty(version) || String.Equals(version, "0.0.0.0")) {
var assemblyName = assembly.GetAssemblyName();
version = assemblyName != null ? assemblyName.Version.ToString() : null;
}
return !String.IsNullOrEmpty(version) && !String.Equals(version, "0.0.0.0") ? version : null;
}
示例2: AsmInfo
/// <summary>
/// Constructor
/// </summary>
/// <param name="assembly"></param>
public AsmInfo(Assembly assembly) {
assembly.ShouldNotBeNull("assembly");
FullName = assembly.FullName;
AssemblyName = assembly.GetName();
// NOTE : CodeBase는 동적으로 Loading 한 Assembly에 대해서는 값을 조회할 수 없다.
// this.CodeBase = assembly.CodeBase;
Company = assembly.GetCompany();
Configuration = assembly.GetConfiguration();
Copyright = assembly.GetCopyright();
Culture = assembly.GetCulture();
DefaultAlias = assembly.GetDefaultAlias();
Description = assembly.GetDescription();
InfomationalVersion = assembly.GetInformationalVersion();
Product = assembly.GetProduct();
Title = assembly.GetTitle();
Trademark = assembly.GetTrandemark();
Version = AssemblyName.Version;
Win32FileVersion = assembly.GetFileVersion();
}