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.
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.
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)
.