如何在我的应用程序中显示上次构建的内部版本号和/或日期时间?

B. *_*non 16 c# versioning build version winforms

我知道我可以这样做以获得应用程序的官方(发布/发布)版本号:

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

...但这仅显示我的应用程序的"发布版本"*("1.0.0.0").我想显示内部版本号.

  • 来自项目| 属性| 发布标签.

除此之外,或者除此之外,我想显示最后一次构建的日期和时间,以便它说"Platypi R Us - 3.14版(2012年7月17日16:22)"

Joh*_*len 17

返回的值Assembly.GetExecutingAssembly().GetName().Version是项目的AssemblyInfo.cs文件中的值:

[assembly: AssemblyVersion("1.0.0.0")]
Run Code Online (Sandbox Code Playgroud)

在构建之前修改这些以指定它返回的值.或者,如同在AssemblyInfo.cs文件中记录的那样:

// 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.*")]
Run Code Online (Sandbox Code Playgroud)