DeveloperBarn Forums

Go Back   DeveloperBarn Forums > Programming & Scripting > Code Samples > ASP.Net

Discuss "Display Assembly File Date And Time" in the ASP.Net forum.

ASP.Net - Post your ASP.Net code samples here.


Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 04-09-2008, 11:57 AM
Wolffy's Avatar
Slaprentice of Wolves

 
Join Date: Mar 2008
Location: Peoria, IL
Posts: 91
Thanks: 1
Thanked 15 Times in 12 Posts
Rep Power: 1
Wolffy is on a distinguished road
Default Display Assembly File Date And Time

We have a requirement on our intranet to display the file date/time of our applciations. There doesn't appear to be a simple way to do this in .NET, but I came up with the following to display what is, basically, the file date/time of the assembly DLL.

In AssemblyInfo.cs ensure you have the following:
Code:
[assembly: AssemblyVersion("2.1.*")]
The will cause the Version Attribute to be set to:
major.minor.date.time
where
date is the number of day since 01 JAN 2000
time is the number of seconds since midnight / 2

So, to return the 'compile' date of the Assembly, I use the following Property:
Code:
public string lastModified
{
   get
   {
      string[] strArray = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split(new char[] { '.' });
      return new DateTime(2000, 1, 1).AddDays(Convert.ToDouble(strArray[2])).AddSeconds(Convert.ToDouble(strArray[3]) * 2).ToString();
    }
}
FWIW.
Reply With Quote
Sponsored Links
Reply

  DeveloperBarn Forums > Programming & Scripting > Code Samples > ASP.Net

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.developerbarn.com/asp-net/115-display-assembly-file-date-time.html
Posted By For Type Date
DeveloperBarn Forums - ASP Help, ASP.Net Help, PHP Help, SQL Help, Tutorials, Windows Help This thread Refback 04-26-2008 09:35 AM


Sponsored Links

ASP.NET Resource Index
a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer.

Free Web Directory
Including Chats and Forums Resources, Offer automatic, instant and free directory submissions.
URLZ Web Directory
URLZ Web Directory

Free Web Directory - Add Your Link
The Little Web Directory
Free Web Directory
Pegasus free web directory is a free directory organised by categories.


All times are GMT -4. The time now is 01:01 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
©2008 DeveloperBarn.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45