468,161 Members | 1,952 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,161 developers. It's quick & easy.

Determining 'Build' date of a solution

Hey gang,

What's the best way to implement a Build version (or "last updated"
date) in my web-app? I have a footer in my master page that displays
the application's name and copyright info etc. I'd like to add a Build
version and build date as well. (Without hardcoding it obviously.)

At first I thought I'd just take the timestamp of the web.config, but
my web.config doesn't change that much. Is there an easy way to
determine what day the entire web-app was built? (or deployed might be
more accurate.)

My web solution is fairly large, about 40 aspx pages, and 12
class-library projects -- so perhaps I should start thinking about
implementing a versioning regime as well.

Any thoughts on this? Thanks.

Roger

Nov 19 '05 #1
2 1559
Roger,
Here's how you would get the build version:

System.Reflection.Assembly asm =
System.Reflection.Assembly.GetExecutingAssembly(); // Get our assembly;
System.Version version = asm.GetName().Version;
string build = version.ToString(); //

To get the date, you can do it this way, but you have to set the correct
FileIOPermissions;

System.IO.FileInfo inf = new System.IO.FileInfo(asm.Location); // get the
location of our executing assembly
DateTime dt = inf.LastWriteTime();
string buildDate = dt.ToString();

Hope that helps.

Dave

"Roger Helliwell" <rh********@telus.net> wrote in message
news:7o********************************@4ax.com...
Hey gang,

What's the best way to implement a Build version (or "last updated"
date) in my web-app? I have a footer in my master page that displays
the application's name and copyright info etc. I'd like to add a Build
version and build date as well. (Without hardcoding it obviously.)

At first I thought I'd just take the timestamp of the web.config, but
my web.config doesn't change that much. Is there an easy way to
determine what day the entire web-app was built? (or deployed might be
more accurate.)

My web solution is fairly large, about 40 aspx pages, and 12
class-library projects -- so perhaps I should start thinking about
implementing a versioning regime as well.

Any thoughts on this? Thanks.

Roger

Nov 19 '05 #2
On Fri, 29 Apr 2005 09:39:21 -0500 in
microsoft.public.dotnet.framework.aspnet, "David Young"
<RE******************@yahoo.com> wrote:
Roger,
Here's how you would get the build version:


Thanks David -- I'll give it a whirl.
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Shawn Wilson | last post: by
8 posts views Thread by Joshua Beall | last post: by
5 posts views Thread by cameron | last post: by
7 posts views Thread by dm_dal | last post: by
2 posts views Thread by Pieter | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by kamranasdasdas | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.