I have a C# WinForms app with an About box. I am putting the version number in the about box using:
FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location)
.FileVersion
This ends up giving me the Subversion revision number from which the executable was built.
I would also like to get the date of the build into the About box. I tried:
File.GetLastWriteTime(Assembly.GetEntryAssembly().Location)
But that gives me the write date of the executable, which only corresponds to the date when the app was installed (we are using ClickOnce) not built.
How can I get the build date?
In Visual Studio projects there is a file AssemblyInfo.cs, but you can use any other .cs file. Look at the attribute AssemblyVersion:
Now you can calculate the build date by using the Version.Build property. The value that Version.Build returns is the number of days since: 2000/1/1