ASP.NET 2.0 version numbering
Today I decided to display the version number of the web application I’m writing, but had to do some hunting around to see how to retrieve this. Basically I had to create an AssemblyInfo.vb file in the project’s App_Code folder that contains the following:
Imports System.Reflection
<Assembly: AssemblyTitle(“Program Title”)>
<Assembly: AssemblyDescription(“Written by Chris Nelms”)>
<Assembly: AssemblyCompany(“My Company Limited”)>
<Assembly: AssemblyVersion(“2.0.*”)>
Then in the Page_Load event of my web form (or anywhere else) I insert these two lines of code:
Dim MyAssembly As System.Reflection.Assembly = System.Reflection.Assembly.Load(“App_Code”)
Dim strVersion As String = MyAssembly.GetName.Version.ToString
That’s all there is to it!