Michael A. Covington said:
Grant Richins said:
[assembly:AssemblyFileVersion("1.0.*")]
This will change into an attribute where 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.
And for posterity, here is some working code. Thanks again!
private DateTime DateCompiled()
// Assumes that in AssemblyInfo.cs,
// the version is specified as 1.0.* or the like,
// with only 2 numbers specified;
// the next two are generated from the date.
// This routine decodes them.
{
System.Version v =
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
// v.Build is days since Jan. 1, 2000
// v.Revision*2 is seconds since local midnight
// (NEVER daylight saving time)
DateTime t = new DateTime(
v.Build * TimeSpan.TicksPerDay +
v.Revision * TimeSpan.TicksPerSecond * 2
).AddYears(1999);
return t;
}