Getting the assemply build number...

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

Hi,

I want to write a page to track changes on a site.

How do I get the build number of the site's dll from a web page?

Thanks in advance.

Stu
 
You can do that with Reflection:

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

Assuming you're using the default autoincrement version number, you can
also calculate the build time from the version number, since the build
number is the number of days since 2000.01.01 and revision=1/2 number
of seconds since midnight. I include that in a collapsible div on each
page of the website I'm working on now, along with the assembly file
timestamp:

System.Reflection.AssemblyName assembly =
System.Reflection.Assembly.GetExecutingAssembly().GetName();
DateTime buildDate =
DateTime.Parse("01/01/2000").AddDays(assembly.Version.Build).AddSeconds(assembly.Version.Revision
* 2);

- Jon
http://weblogs.asp.net/jgalloway
 
Back
Top