在C#.NET的WINFORM程序发布后,怎样用代码查看软件的版本号?
3个回答
展开全部
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));
this.labelAppName.Text = description.Description;
//this.labelEdition.Text = description.Description;
//this.labelEdition.Text = copyright.Copyright;
this.labelEdition.Text = Application.ProductVersion;
}
{
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));
this.labelAppName.Text = description.Description;
//this.labelEdition.Text = description.Description;
//this.labelEdition.Text = copyright.Copyright;
this.labelEdition.Text = Application.ProductVersion;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Application.ProductVersion
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
application.version好像是这个
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询