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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 liketypeof(HomeController).Assembly.GetName().Version.ToString(3).