Quantcast
Channel: Versioning an ASP.NET web app - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by Rex M for Versioning an ASP.NET web app

$
0
0

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("<!--");        writer.Write("Version: ");        writer.Write(GetAssemblyVersion());        writer.Write("-->");    }    private string GetAssemblyVersion()    {        try        {            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;        }        catch        {            return "Failed to load assembly";        }    }}

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>