>Here is sample code that retrieves build date from an assembly:
>
>AssemblyName an = Assembly.GetEntryAssembly().GetName();
>DateTime date = new DateTime(2000, 1, 1, 0, 0, 0);
>date += TimeSpan.FromDays(an.Version.Build) +
>TimeSpan.FromSeconds(an.Version.Revision * 2);
That *ONLY* works *IF* you *DO NOT* change your assembly version
numbering !
By default, the "build" portion of your assembly will indeed reflect
the build date - but you can change that, if you wish to! And then,
your method here will fail miserably......
Marc
================================================================
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
Michal Dabrowski - 10 May 2005 10:19 GMT
>>Here is sample code that retrieves build date from an assembly:
>>
[quoted text clipped - 5 lines]
> That *ONLY* works *IF* you *DO NOT* change your assembly version
> numbering !
That's true, sorry, forgot to mention this. One has to leave the two
asterisks at the end of assembly version number for this method to work.
> By default, the "build" portion of your assembly will indeed reflect
> the build date - but you can change that, if you wish to! And then,
> your method here will fail miserably......
Yes, but looking at file creation date can also produce incorrect result
if the date is not preserved by all programs used between build and
deployment (although I think that most of them preserve it).
Best regards,
Michal Dabrowski