Hope fully the title was somewhat descriptive.
I have a winform application written in C# with .net 2.0. I would like to have the last compile date automatically updated to a variable for use in the about box and initial splash box. Currently I have a string variable that I update manually. Is there any way to do this?
VS2008 .net 2.0 c#
Another trick (which you may not be able to use) is to leverage the automatic build and revision numbers generated by .NET. If your AssemblyInfo has:
[assembly: AssemblyVersion("1.0.*")]
The last two numbers are just a date/time stamp. Some code (list below) may help:
Version v = Assembly.GetExecutingAssembly().GetName().Version;
DateTime compileDate = new DateTime((v.Build - 1) * TimeSpan.TicksPerDay + v.Revision * TimeSpan.TicksPerSecond * 2).AddYears(1999);
Edit: here's an alternative answer that may be a little clearer to follow than what I put: https://stackoverflow.com/a/804895/2258
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With