Getting the assemply build number...

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
 
J

jongalloway

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top