mattdwen
mattdwen

Reputation: 5428

How to display an ASP.net MVC project version in page?

In WinForms, I'd use Application.ProductVersion.

I've tried using System.Reflection.Assembly in various ways but can never get the version of just the MVC project.

Upvotes: 4

Views: 5378

Answers (1)

Agent_9191
Agent_9191

Reputation: 7253

Provided this code is explicitly in the MVC project (rather than in a helper assembly), you should be able to use System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3), which returns the major, minor, and revision numbers. Otherwise you might want to use something like typeof(HomeController).Assembly.GetName().Version.ToString(3).

Upvotes: 7

Related Questions