Accessing Version Number in .Net

Q: How do I programatically access the version number of an ASP.Net application?

A: The version number, and other general information, is kept in the AssemblyInfo.vb (for VB.Net projects). All information is housed in attributes in the file, as listed below:

Assembly: AssemblyTitle("MyApp")
Assembly: AssemblyDescription("A Sample Program")
Assembly: AssemblyCompany("ABC Software Corp.")
Assembly: AssemblyProduct("")
Assembly: AssemblyCopyright("2006")
Assembly: AssemblyTrademark("")
Assembly: CLSCompliant(True)
Assembly: AssemblyVersion("2.0.*")

To access the application version through .Net code, use
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(). The value displayed will be 4 sets of numbers, separated by '.' (similar to TCP/IP address). The version information for an assembly consists of the following four values:
Major Version
Minor Version
Build Number
Revision

Comments

Popular posts from this blog

Using VB Script to display part of an IP address

Working with double quotes (") in VB.Net

Sep '19 Announcements