Can I populate variables at compile time?

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

I would like to put program info in my applications' about screen such as
compile date & time, lines of code, etc. Is there a way to do this
automatically when I compile?
 
You can get the version number of you application. and if you auto increment
your version number, you do get something similar to what you want.

The other thing you can try is to take the Date and Time of creation of your
assembly to be the compilation time and dispaly that.
 
Terry Olsen said:
I would like to put program info in my applications' about screen such as
compile date & time, lines of code, etc. Is there a way to do this
automatically when I compile?

Not directly. I am curious why you don't want to set the labels' text at
runtime.
 
Herfried,
Not directly. I am curious why you don't want to set the labels' text at
runtime.
I think that at least beside Terry, Anand, Andrew, I (and when you reread
the question) you do that.

It can in some cases be handy.

:-)

Cor
 
Cor Ligthert said:
I think that at least beside Terry, Anand, Andrew, I (and when you reread
the question) you do that.

I misread the OP's post. I thought he wanted to display simple version
information only.
 
Terry,
As the others suggest, getting lines of code is going to be challenging, I
seriously question the usefulness of it in an about box.

Compile date & time would be useful, but I have not found a good method of
retrieving it. I've considered a custom attribute, however I'm not sure how
one would define said attribute, as one would need the value of the
attribute set at compile time. A pre-compile utility that initialized the
attribute value (ala the AssemblyVersion attribute) might be useful.

Generally I display a number of Assembly level attributes in my About Box,
including by not limited to:

Assembly.GetName().Name
Assembly.GetName().Version
AssemblyTitleAttribute.Title
AssemblyProductAttribute.Product ' product name
AssemblyInformationVersionAttribute.InformationalVersion ' product
version
AssemblyConfigurationAttribute.Configuration ' Debug/Release
AssemblyFileVersionAttribute.Version

In fact I display the above info for all loaded assemblies in a grid (ala
the VS about box) to see version info for class libraries...

A VS 2005 version (it uses Generics) of my AboutBoxForm is available as part
of the of my Xml Export Example at:

http://www.tsbradley.net/Samples/VSTO/Xml.Export.Sample.aspx

I hope to have a VS 2003 version as a recipe at the above site later this
week...

--
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


|I would like to put program info in my applications' about screen such as
| compile date & time, lines of code, etc. Is there a way to do this
| automatically when I compile?
|
|
 
Back
Top