0

I have a website and I want to include a "Last Compile Time: XX:XX:XX" in the footer of the website. Is there an automated way to alter the contents of an asp:label at compile time?

Chuck
  • 3
  • 1
  • Similar to this question: http://stackoverflow.com/questions/1600962/c-displaying-the-build-date Coding Horror has a good blog entry covering this this: http://www.codinghorror.com/blog/2005/04/determining-build-date-the-hard-way.html – xcud Oct 30 '10 at 01:42

2 Answers2

5

You could use reflection to find the current assembly and get the last write time. Then you could either bind the Text property of your current label, or set it in the Page Load.

File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location)

Or you could use UTC

File.GetLastWriteTimeUtc(Assembly.GetExecutingAssembly().Location)
Yuriy Faktorovich
  • 67,283
  • 14
  • 105
  • 142
0

We typically use the creation time of the assembly. It seems depending on the install the last write times may differ.

File.GetCreationTimeUtc(System.Reflection.Assembly.GetExecutingAssembly().Location)
Bryan Allred
  • 606
  • 4
  • 5