Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am working with Visual Basic in Visual Studio 2010. I want to automatically include the latest compile date and time in the executible. Is that possible?
Posted

It's possible, yes - just about everything is - but that doesn't mean it's easy. It isn't, particularly.

There is no direct way to do it: there are two options I can think of.
1) Access the executable file that started the program at run time and pick up the CreateTime from that. This doesn't include the timestamp in your program, but it provides a mechanism to do it. =You could pick this up by using FileInfo on Application.ExecutablePath.

2) Use custom pre-build step that creates a small source file containing a simple class that returns the string. You would want to add a post-build event that deletes it as well so it isn't re-used. If the source file it generates is included in your project it will include the timestamp when you build it.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900