3

I've been learning coming from a background and am currently working on a simple server-client project as a console application.

I am looking to change the console's title to reflect the date/time the application was built, something similar to this:

- Crysis Wars Master Server - Dec 28 2014 (16:20)

or from the question I linked below:

enter image description here

I have an identical question but for C++, with the answer being:

...time of built is provided by the __TIME__ macro. In your example they also use __DATE__ macro which provides the date.

Obviously VB.NET is an entirely different programming language and for that reason the __TIME__ and __DATE__ macros cannot be used.

I found the solution to retrieve the date the application was built in C#, which also works for VB.NET:

File.GetCreationTime(Assembly.GetExecutingAssembly().Location)

..but however couldn't find anything to retrieve the time the application was built.

Is this possible? If so, how can I retrieve the time the application was built?

I also do not want to input the date/time manually, and as I said in my other question:

This would have many advantages, including easy identification of different builds of the application.

I also do not use the 'standard' way of incrementing the version of my applications, so I cannot use the way Jeff Atwood uses in his blog.

Community
  • 1
  • 1
AStopher
  • 4,207
  • 11
  • 50
  • 75

1 Answers1

1

Since at Managing Versions article of MSDN You can see that all values obtained while working with versions are obtained from XML files that store them, and there's no time values, I almost sure to say that It's not possible to get it easy.

However, using as you said File Class:

Dim fecha As Date = IO.File.GetCreationTime(Assembly.GetExecutingAssembly().Location)

MessageBox.Show(fecha.TimeOfDay().ToString)

Hope It's what you're looking for.

Btc Sources
  • 1,912
  • 2
  • 30
  • 58
  • That has some problems. The EXE is sometimes be [moved](http://msdn.microsoft.com/en-us/library/ms404279(v=vs.110).aspx) before executing making Location incorrect, and Created Date/Time is just that, not the last compiled time, which users can change. – Ňɏssa Pøngjǣrdenlarp Dec 28 '14 at 17:25
  • Mm that's right, so the solution left would be to create a constant in the application in order to keep there the built time value. With the problem added that this won't be the real built time since you've to put it yourself, and won't be automatically updated with each compilation. – Btc Sources Dec 28 '14 at 17:32
  • This answers the question in my instance since the application is a master-server and is unlikely to be moved around. – AStopher Dec 29 '14 at 23:02