How would you go about making sure the custom attribute actually knew
what the build time was though? I don't understand how you are
proposing that your solution would work.
If it looks like this:
[assembly:BuildTimeStamp]
then how exactly is it supposed to know when the build occurred? Custom
attributes don't get instantiated at build time. They get instantiated
at the point at which someone asks for them - how's it going to work out
the build time?
And if you mean something like this:
[assembly:BuildTimeStamp("2005-01-25 14:58:00")]
then that doesn't really help. It still leaves needing a solution to
exactly the same problem Raj posed in the first place: how do you
arrange for that text string to be whatever the time of day is at when
the build occurred?
Surely custom attributes offer just another form of the same problem,
not a solution?
--
Ian Griffiths
DevelopMentor
> -----Original Message-----
> From: Stoyan Damov
>
> You can tag your assembly with a custom attribute and extract it at
> runtime (provided you have the necessary permissions at runtime).
> I wouldn't call C#'s preprocessor a preprocessor. It is... well, it
> SUCKS big time.
>
>
> -----Original Message-----
> From: Raj Malli
>
> Is there a way by which I can programmatically determine the build
time
> of an assembly? I would like to show the following information in the
> "About" box of my application: Application Name, Version and Build
Time.
>
> I do not want to do the following:
> - Use the last two parts of the assembly version to encode the time
> - Get the last modified time from the assembly file using (say) the
> FileInfo class
>
> In C/C++, this is how I'd have done this:
> #define BUILD_TIME __TIME__
> void OnAbout() {
> ...
> MessageBox(BUILD_TIME);
> ...
> }
> I know C# supports a preprocessor. Can I do something similar to the
> above in C#? Otherwise what other options do I have?
===================================
This list is hosted by DevelopMentor� http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com