Find build date of an assembly

Function RetrieveLinkerTimestamp(ByVal filePath As String) As DateTime<br />  Const PeHeaderOffset As Integer = 60<br />  Const LinkerTimestampOffset As Integer = 8<br /><br />  Dim b(2047) As Byte<br />  Dim s As Stream<br />  Try<br />    s = New FileStream(filePath, FileMode.Open, FileAccess.Read)<br />    s.Read(b, 0, 2048)<br />  Finally<br />    If Not s Is Nothing Then s.Close()<br />  End Try<br />  <br />  Dim i As Integer = BitConverter.ToInt32(b, PeHeaderOffset)<br />  <br />  Dim SecondsSince1970 As Integer = BitConverter.ToInt32(b, i + LinkerTimestampOffset)<br />  Dim dt As New DateTime(1970, 1, 1, 0, 0, 0)<br />  dt = dt.AddSeconds(SecondsSince1970)<br />  dt = dt.AddHours(TimeZone.CurrentTimeZone.GetUtcOffset(dt).Hours)<br />  Return dt<br />End Function<br />
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.