I needed to display the application version in a file based ASP.NET 3.5 application written in Visual Basic. I wrote the following methods in my AssemblyInfo.vb file in the App_Code directory and it worked! Out popped the Version Number of 1.0.0.10 instead of that annoying 0.0.0.0.
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("blah")>
<Assembly: AssemblyDescription("blah")>
<Assembly: AssemblyCompany("blah")>
<Assembly: AssemblyProduct("blah")>
<Assembly: AssemblyCopyright("2005, 2006, 2007, 2008")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("BCB55B59-EA39-4C62-BFFE-DE7800B420C8")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.0.0.10")>
Public Class AssemblyInfo
Public Shared Function GetVersionNumber() As String
Return (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString())
End Function
End Class