我怎么能在我的应用程序显示上次构建的内部版本号和/或日期时间? [英] How can I display the Build number and/or DateTime of last build in my app?

查看:308
本文介绍了我怎么能在我的应用程序显示上次构建的内部版本号和/或日期时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我能做到这一点,以获得应用程序的官方(发布/发表)版本号:

I know that I can do this to get the app's official (release/publish) version number:

string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();  
this.Text = String.Format("Platypi R Us - version {0}", version);

...但是这只能说明我的应用程序*的发布版本(1.0.0.0)。我想显示的版本号。

...but this only shows a "Publish version" of my app* ("1.0.0.0"). I want to show the build number.


  • 从工程|属性|发布选项卡。

除了上述,或除此之外,我想展示的最后构建的日期和时间,因此,它说的Platypi玩具反斗城 - 版本3.14(7/17/2012十六时22分)

Barring that, or in addition to that, I'd like to show the date and time of the last build, so that it says "Platypi R Us - version 3.14 (7/17/2012 16:22)"

推荐答案

的GetName()。版本从 Assembly.GetExecutingAssembly()返回的值。这是在项目的AssemblyInfo.cs文件:

The value returned from Assembly.GetExecutingAssembly().GetName().Version is that in your project's AssemblyInfo.cs file:

[assembly: AssemblyVersion("1.0.0.0")]

构建之前修改这些指定其返回值。或者,如记录在同一个AssemblyInfo.cs文件:

Modify these before a build to specify the value it returns. Or, as documented in the same AssemblyInfo.cs file:

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

这篇关于我怎么能在我的应用程序显示上次构建的内部版本号和/或日期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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