Displaying Version information in C# ASP.NET 2.0 and 3.5. - More Wally - Wallace B. McClure
in

MoreWally.com

Giving people what they want, More Wally. This is the technical and personal blog site of
Wallace B. (Wally) McClure.

This Blog

Syndication

Technical Sites

More Wally - Wallace B. McClure

This blog will have all kinds of posts about Wally McClure. In it, there will be tons of .NET and computer programming posts as well as Wally's views on life in general. As you might guess, this site and blog help you get More Wally in your life. What more could anyone want? .NET, ADO.NET, ASP.NET, AJAX, Atlas, Microsoft AJAX Library, ASP.NET 2.0 AJAX Extensions, ............

Displaying Version information in C# ASP.NET 2.0 and 3.5.

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());
    }
}

Published Jul 15 2008, 06:25 PM by admin
Filed under: ,

Comments

No Comments
2006 - Wallace B. McClure
Powered by Community Server (Non-Commercial Edition), by Telligent Systems