A project I am working on required a number of small apps to process various files as they get delivered around our core eCommerce system. As modifications were being made I quickly realized that displaying the build date of the app was a nice and simple method of making sure the right version of the system app was being used and would be handy to log in the log file.
Here is some simple C# code to achieve this:
static void Main(string args)
Console.WriteLine(“Your program name…”);
DateTime buildDate = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).LastWriteTime;
Console.WriteLine(“Build Date: ” + buildDate+”\n”);