Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I display the Build number and/or DateTime of last build in my app?

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);

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

  • From the Project | Properties | Publish tab.

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)"

like image 628
B. Clay Shannon-B. Crow Raven Avatar asked Jul 18 '12 00:07

B. Clay Shannon-B. Crow Raven


People also ask

How do I find the build number on my Android?

The build number is reported in Settings > About phone. For Android Oreo, it is shown in Settings > System > About phone.


1 Answers

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

[assembly: AssemblyVersion("1.0.0.0")]

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.*")]
like image 69
John Arlen Avatar answered Oct 23 '22 03:10

John Arlen