Menu

MVC – Display Version Number in Your UI

August 29, 2013 - .NET / C#, ASP.NET MVC, Deployment, Geek Bits, Web Stuff
MVC – Display Version Number in Your UI

If you ever want to display the version of your app in the UI (useful in development with lots of environments) you can do the following.

In your Global.asax start method you can add:

Version version = Assembly.GetExecutingAssembly().GetName().Version;
Application["Version"] = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);

This somewhere in your site UI you can do this:

@HttpContext.Current.ApplicationInstance.Application["Version"]
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

*