Can I extract creation time of Assembly via reflection?

  • Thread starter Thread starter Sky Sigal
  • Start date Start date
S

Sky Sigal

Hello:
Been looking at the specs for the WebResources attribute in Net framework 2.0 and looking to emulate
it in 1.1

One of the parts needed extracts the build time of the assembly... But I can't for the life of me
figure out how they did that for . Reflection gets me to a CodeBase -- but not the ghost location --
and the System.IO.Files would get me the time the File was copied into that directory (I havn't
found how to do this -- I'm just guessing...)

So I was wondering if there was an attribute/other that could be reflected on that would return the
true Build date? If so, a code snippet would be...fantastic.

Thanks a million,
Sky
 
Sky,

There is not. The build time is not captured in the assembly anywhere,
and you can't depend on the last modified date of the assembly either,
because the local copy might have been downloaded from somewhere else.

If you are using this for identification purposes, then I would
recommend you use a hash of the assembly, and not the build time.
 
Dear Nicholas:
Thanks for that info.

When you say Hash of the Assembly, is it as simple as oAssembly.GetHashCode() -- that's it?

Thank you,
Sky


Nicholas Paldino said:
Sky,

There is not. The build time is not captured in the assembly anywhere,
and you can't depend on the last modified date of the assembly either,
because the local copy might have been downloaded from somewhere else.

If you are using this for identification purposes, then I would
recommend you use a hash of the assembly, and not the build time.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Sky Sigal said:
Hello:
Been looking at the specs for the WebResources attribute in Net framework 2.0 and looking to emulate
it in 1.1

One of the parts needed extracts the build time of the assembly... But I can't for the life of me
figure out how they did that for . Reflection gets me to a CodeBase -- but not the ghost location --
and the System.IO.Files would get me the time the File was copied into that directory (I havn't
found how to do this -- I'm just guessing...)

So I was wondering if there was an attribute/other that could be reflected on that would return the
true Build date? If so, a code snippet would be...fantastic.

Thanks a million,
Sky
 
Back
Top