How to put the build date of application somewhere in the application?

后端 未结 4 1935
南旧
南旧 2020-12-28 09:39

I would like to put the date the application was built somewhere in the application. Say the about box. Any ideas how this can be done? I need to do this for C# but I am als

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 10:04

    Typically we just go with the executable's last modify date. This will be set when the exe is built and usually never changes (short of someone actually editing the file). When the file is installed, copied, moved, etc, Windows doesn't change that value.

    DateTime buildDate = 
       new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
    

    We use this technique for the about dialogs in our C# and C++ apps.

提交回复
热议问题