Hi Ken,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to put the build date in the
assembly and get it programatically. If there is any misunderstanding,
please feel
free to let me know.
Gregory has provided us with two good ideas. Besides we can also use the
auto-generated version number to achieve this.
If we use <Assembly: AssemblyVersion("1.0.*")> as assembly version, VS.NET
will generate build number and revision according to the current date and
time. We can try to use the following code to get the build date.
Private Function BuildDate() As DateTime
'Build dates start from 01/01/2000
Dim result As Date = #1/1/2000#
'Retrieve the version information from the assembly from which this
code is being executed
Dim version As System.Version =
System.Reflection.Assembly.GetExecutingAssembly.GetName.Version
'Add the number of days (build)
result = result.AddDays(version.Build)
'Add the number of seconds since midnight (revision) multiplied by 2
result = result.AddSeconds(version.Revision * 2)
'If we're currently in daylight saving time add an extra hour
If TimeZone.IsDaylightSavingTime(Now,
TimeZone.CurrentTimeZone.GetDaylightChanges(Now.Year)) Then
result.AddHours(1)
Return result
End Function
For more information, please check the following link:
http://dotnetfreak.co.uk/blog/archive/2004/07/08/146.aspx
PS: There is a little mistake in the code provided in the link. I have
fixed it in my code.
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."