HighTechTalks DotNet Forums  

Getting the last compilation date of an assembly

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Getting the last compilation date of an assembly in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Yonatan
 
Posts: n/a

Default Getting the last compilation date of an assembly - 08-07-2006 , 06:19 AM






I need to display the date/time of the last version of my application.
There is the possibility of manually setting the date/time every time.
However, I prefer doing this (if possible) by getting the last compilation
date of the main assembly.
Is it possible? If yes, then how?
Or should this be done by using the last-modified-date of the assembly's DLL ?

Thanks.

Reply With Quote
  #2  
Old   
Yonatan
 
Posts: n/a

Default Re: Getting the last compilation date of an assembly - 08-07-2006 , 07:00 AM






Hi Vadym,

Thanks for your answer, it really helped!
I personally find the second method (with the calculations) a bit more
elegant.

Thanks again!


"Vadym Stetsyak" wrote:

Quote:
Hello, Yonatan!

Y> I need to display the date/time of the last version of my application.
Y> There is the possibility of manually setting the date/time every time.
Y> However, I prefer doing this (if possible) by getting the last
Y> compilation date of the main assembly.
Y> Is it possible? If yes, then how?
Y> Or should this be done by using the last-modified-date of the assembly's
Y> DLL ?

Last modified data is the simplest approach.

OTOH

If you have assembly version generated like this
[assembly:AssemblyFileVersion("1.0.*")]
then you can calculate compilation date and time.

Compiler will set assembly version in the way that
the 3rd part is the number of days since Jan 1, 2000, and the 4th part is the number of seconds since midnight
(local time) divided by 2.
This attribute can be accessed from the Assembly
object, or as the FileVersion looking at the Win32 file version resource.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.