A Self-Populating .NET About Box

One thing that has always been a little annoying is updating/changing the about box every time the program version or date changes. Here’s a neat little way to make it pull the values from the assembly info:

private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
Assembly assembly = Assembly.GetExecutingAssembly();
AssemblyCopyrightAttribute copyright =
assembly, typeof( AssemblyCopyrightAttribute ) );
AssemblyTitleAttribute title =
assembly, typeof( AssemblyTitleAttribute ) );
System.IO.FileInfo info = new System.IO.FileInfo( assembly.Location );
DateTime date = info.LastWriteTime;

title.Title +
” version ” +
assembly.GetName().Version.ToString() +
” released ” +
date.ToShortDateString() +
“.\nThis application is ” +
copyright.Copyright +
“\nWritten by Jason Champion (Xangis).\nFor the latest version, visit http://www.basternae.org.”,
“About ” + title.Title );

With the following AssemblyInfo:

[assembly: AssemblyTitle(“Basternae Editor”)]
[assembly: AssemblyCopyright(“Copyright © 2006-2008 Zeta Centauri, Inc.”)]
[assembly: AssemblyVersion(“”)]

We get the following about box:

About Box Screenshot

It’s pretty easy to customize it to grab other assembly attributes once you know how to retrieve them.

1 thought on “A Self-Populating .NET About Box

Comments are closed.