Groups | Blog | Home
all groups > vb.net > october 2005 >

vb.net : Can I populate variables at compile time?


Terry Olsen
10/19/2005 10:16:26 PM
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?

Herfried K. Wagner [MVP]
10/20/2005 12:00:00 AM
"Cor Ligthert [MVP]" <notmyfirstname@planet.nl> schrieb:
[quoted text, click to view]

I misread the OP's post. I thought he wanted to display simple version
information only.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Andrew McNerlin
10/20/2005 2:38:33 AM
Hello Terry,

It might be worth looking at the Visual Studio Extensibility Center at:

http://msdn.microsoft.com/vstudio/extend/

Hope this helps,

Andrew McNerlin

[quoted text, click to view]

Anand[MVP]
10/20/2005 3:07:02 AM
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.

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com


[quoted text, click to view]
Jay B. Harlow [MVP - Outlook]
10/20/2005 9:54:08 AM
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


[quoted text, click to view]
|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?
|
|

Herfried K. Wagner [MVP]
10/20/2005 12:14:59 PM
"Terry Olsen" <tolsen64@hotmail.com> schrieb:
[quoted text, click to view]

Not directly. I am curious why you don't want to set the labels' text at
runtime.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Cor Ligthert [MVP]
10/20/2005 12:23:58 PM
Herfried,

[quoted text, click to view]
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

AddThis Social Bookmark Button