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 0.0.5.0 instead of that annoying 0.0.0.0.
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
[assembly: AssemblyTitle("blah")]
[assembly: AssemblyCopyright("blah")]
[assembly: AssemblyVersion("0.0.5.0")]
[assembly: AssemblyFileVersion("0.0.5.0")]
/// <summary>
/// Summary description for AssemblyInfo
/// </summary>
public class AssemblyInfo
{
public AssemblyInfo()
{
//
// TODO: Add constructor logic here
//
}
public static string GetVersionNumber()
{
return (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
}
}