如何将应用程序的生成日期放在应用程序中的某个位置? [英] How to put the build date of application somewhere in the application?

查看:48
本文介绍了如何将应用程序的生成日期放在应用程序中的某个位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将应用程序构建的日期放在应用程序中的某个位置.说一下关于"框.任何想法如何做到这一点?我需要针对C#进行此操作,但我也在寻找一个总体思路,因此您可以针对除C#之外的任何特定语言进行回答.

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 also looking for a general idea, so you can answer this for any specific language other than C#.

推荐答案

通常,我们只考虑可执行文件的最后修改日期.该文件将在生成exe文件时设置,并且通常不会更改(缺少实际编辑文件的人).安装,复制,移动文件后,Windows不会更改该值.

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;

我们将这种技术用于C#和C ++应用程序中的About对话框.

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

这篇关于如何将应用程序的生成日期放在应用程序中的某个位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆