> > Is there a way for my EXE to tell when it was built?
The idea is to write a copyright date that shows "Copyright 2005-" and then
the date the EXE was last built
According to Don Box (ISBN 0-201-73411-7) page 24, if you use an
AssemblyVersion attribute like
[assembly: AssemblyVersion("1.0.*")]
the third component of the version (major.minor.build.revision) is the
number of days since 2/1/2000.
And, since the revision is the seconds since midnight / 2:
/// <summary>
/// Returns build date/time, assuming Version was specified as AssemblyVersion("1.0.*") (or any other major.minor)
/// </summary>
/// <param name="V">A Version instance, with build date/time info in build.revision fields</param>
/// <remarks>
/// Date/time does not honor daylight savings time.
/// </remarks>
public static DateTime BuildDateTime(Version V)
{
return new DateTime(2000, 2, 1) +
new TimeSpan(V.Build, 0, 0, V.Revision * 2);
}
Note that the timestamp is currently 1 hr off - I **assume** this
means that it uses the system's offset from UMT and is not daylight
savings time aware. That for builds from midnight to 1 AM (DST) it will
show the previous day. But I haven't tested this. ;-)
--
www.midnightbeach.com