3

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 7th jan to install it. Build on date comes 7th jan not 1stJan.

Any ideas ?

Rohit
  • 6,365
  • 14
  • 59
  • 90

1 Answers1

1

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.

João Angelo
  • 56,552
  • 12
  • 145
  • 147
  • I'm looking for something prebuild property. – Rohit Jan 06 '11 at 12:34
  • There isn't any assembly attribute applicable to what you want to do. – João Angelo Jan 06 '11 at 12:39
  • Yeah, there is no assembly attribut but i'm still wondering why LastWriteTime dont work here. and If i go by adding an attribute then i think this would need to be updated everytime releasing a new build. Right ? – Rohit Jan 06 '11 at 12:46
  • :) Thanks, I tried to do this thing too before putting question here but we need build version for maintaining database version. We've mapped that with db :( ... – Rohit Jan 06 '11 at 12:59