Like a Version
- In AssemblyInfo.cs, change this:
[assembly: AssemblyVersion("1.0.0.0")]
...to this:
[assembly: AssemblyVersion("1.0.*")]
- Add "
using System.Reflection;
" to your main form.
- Add this method to your main form:
private void SetVersionInfo()
{
Version versionInfo = Assembly.GetExecutingAssembly().GetName().Version;
DateTime startDate = new DateTime(2000, 1, 1);
int diffDays = versionInfo.Build;
DateTime computedDate = startDate.AddDays(diffDays);
string lastBuilt = computedDate.ToShortDateString();
this.Text = string.Format("{0} - Version {1} ({2})",
this.Text, versionInfo.ToString(), lastBuilt);
}
- Finally, in the main form's
Load
event, add a call to that method:
private void FormMain_Load(object sender, EventArgs e)
{
SetVersionInfo();
. . .
}
Now when you run your app, it will append the version info to whatever your form's Text
property is set to. This helps to verify that users are using the most recent (or most recently released, anyway) version of your app when they call for support. Of course, they never do that, so this tip is completely worthless.