开发者

Built on - date information of a .net 3.5 wpf application

I want to show Build On date in About message box, current i'm using File.LastWriteTime (Assembly.GetEntryAssembly(). Location).

//But facing an issue with this approach. Build time comes the time when i installed my app.

E.g. on 1st jan, i created a build and then run .exe on 7t开发者_JS百科h jan to install it. Build on date comes 7th jan not 1stJan.

Any ideas ?


You can create your own AssemblyBuildTimestampAttribute and use it just like the AssemblyVersionAttribute is used so that you can tag your builds with a version and also with a timestamp.

If you just need the date part and not the time and also want it to be managed automatically you can change the version attribute to something like AssemblyVersion("1.2.*"). The asterisk means that the build and revision numbers will be generated automatically. If I recall correctly the default build number is the number of days elapsed since January 1, 2000 so this allows you to do some math and obtain the day the assembly was built.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜