C# 如何在我的应用程序中显示上次生成的生成编号和/或日期时间?
我知道我可以这样做来获取应用程序的官方(发布/发布)版本号:C# 如何在我的应用程序中显示上次生成的生成编号和/或日期时间?,c#,winforms,build,version,versioning,C#,Winforms,Build,Version,Versioning,我知道我可以这样做来获取应用程序的官方(发布/发布)版本号: string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.Text = String.Format("Platypi R Us - version {0}", version); …但这只显示我的应用程序*(“1.0.0.0”)的“发布版本”。我想显示构建编号 从项目|属性|发布选项卡 除此之外,或者除此之外,我想显
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
this.Text = String.Format("Platypi R Us - version {0}", version);
…但这只显示我的应用程序*(“1.0.0.0”)的“发布版本”。我想显示构建编号
- 从项目|属性|发布选项卡
除此之外,或者除此之外,我想显示上次生成的日期和时间,以便显示“Platypi R Us-version 3.14(7/17/2012 16:22)”从
Assembly.getExecutionGassembly().GetName()返回的值。版本
在项目的AssemblyInfo.cs文件中:
[assembly: AssemblyVersion("1.0.0.0")]
// 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.*")]
在生成之前修改这些值,以指定它返回的值。或者,如同一AssemblyInfo.cs文件中所述:
[assembly: AssemblyVersion("1.0.0.0")]
// 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.*")]
潜在的复制品我根本不会称之为复制品——他想要我不想要的东西(显示发布版本号)。我可以这样做(目前正在这样做),但我需要一个内部版本号,以便我可以验证用户是否正在运行我部署的最新内部版本。您是指程序集的文件版本吗?该版本由4个数字组成:主要、次要、内部版本和修订版。Rafael的链接显示了如何自动增加它,从而为每个构建提供一个唯一的值。@Rafael:任何能够区分一个构建和另一个构建的东西;我将再看一看这个链接,因为我一开始并没有看到John提到的内容。