Equivalent of __DATE__, __TIME__ macros in C#
Is there an equivalent of __DATE__ and __TIME__ in C#? Basically what I'm trying to do is place some build timestamping in a C# application. One possibility I saw on Microsoft's website was to do the following: Assembly assem = Assembly.GetExecutingAssembly(); Version vers = assem.GetName().Version; DateTime buildDate = new DateTime(2000, 1, 1).AddDays(vers.Build).AddSeconds(vers.Revision * 2); Console.WriteLine(vers.ToString()); Console.WriteLine(buildDate.ToString()); However, this only works if your version in AssemblyInfo.cs is "1.0..", which ours won't be.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.