I'm not even sure if versioning is the right word for it, but it'll have to do. I want to start putting a 'Version x.x.xx' note on our internal apps by request of our users, so they have a rough of idea of when it gets updated (and in the future, make that a link that shows changes). It seems like using the AssemblyInfo.cs file is a good idea - it lets you automatically update the build+revision which is nice (for the .DLL of the web application).

Is this a decent approach? Then whenever I reach the major/minor version milestones for my app. I can just update those manually, correct? All of this assumes I can actually get the version information from my app. somehow, which I haven't a clue how to do either.

Was it helpful?


We do the same thing in our application. Although you can add the version number manually, our version info is added to the assembly as part of our automated build process (we use a customized TFS 2008 service), which I highly recommend. Here's the control we use (we just put this at the bottom of the master page):

public class BuildVersion : WebControl
    /// <summary>
    /// Render override
    /// </summary>
    /// <param name="writer"></param>
    protected override void Render(HtmlTextWriter writer)
        writer.Write("Version: ");

    private string GetAssemblyVersion()
            Object[] atts = Assembly.GetAssembly(this.GetType()).GetCustomAttributes(true);
            foreach (Object o in atts)
                if (o.GetType() == typeof(AssemblyVersionAttribute))
                    return ((AssemblyVersionAttribute)o).Version;
            return String.Empty;
            return "Failed to load assembly";


You can use version numbers in the way you describe, just changing the numbers in the AssemblyInfo file as you build new releases but it's better when linked to a Source Control system. We use CrusieControl.NET and Web Deployment projects to set the version number but I'm sure others will have other suggestions.

Also you can get the version number from a compiled Website by using this code:


If your running in Debug mode before you compile it will show but you can check for this and display "Development" or some such to show to yourself it is running locally (not that you wouldn't know but then if you ever do see you know something is wrong.

Hope that helps

It's not a bad idea. The solution to get your ASP.NET Web App DLL version is simple:


My.Application.Info.Version (VB.NET)


Gain access to the My namespace as shown here

Much easier than using tons of code.

We automate the versioning with subversion, ccnet and nant.

Our script parses the folder path( /Branches/1.4.5/Source...) and extracts the version number (1.4.5). After that we retrieve the current revision number from subversion and we place it in the last position of the version (i.e. Once we have the complete version number we inject it into all the assemblies and write it to a version.txt files so it easy to determine what version is currently deployed on the web servers.

Given an Assembly a, use a.GetName().Version.ToString() to get the version in code.

GetName returns an AssemblyName.

The version returns the version as specified in your AssemblyInfo file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow