private void GetEdition()
{
Assembly assembly = Assembly.GetExecutingAssembly();
//this.labelEdition.Text = assembly.FullName;
// 获取程序集元数据
AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)
AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
typeof(AssemblyCopyrightAttribute));
AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)
AssemblyDescriptionAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(),
typeof(AssemblyDescriptionAttribute));
string a = description.Description;
string b = description.Description;
string c = copyright.Copyright;
string d = Application.ProductVersion;
}
方法四:
string path = @"C:WINNTMicrosoft.NETFrameworkv1.1.4322System.dll";
Assembly assembly = Assembly.LoadFile(path);
AssemblyName assemblyName = assembly.GetName();
Version version = assemblyName.Version;
Console.WriteLine(assemblyName.FullName);
string a=version.Major.ToString();
string b= version.Minor.ToString();
string c=version.Revision.ToString();
string d=version.Build.ToString();
只要得到Assembly ,剩下的都好说,可以看看Assembly的几个静态方法,应该可以满足所有需要了。比如//得到Mscorlib.dll Assembly.GetAssembly(typeof(string))