Let’s suppose, we have existing MVC project and we want to know the version of that project. How we can find the version of our existing MVC Application?
There are two ways to find the existing MVC project version- first at design time and second at runtime.
Let’s first check the design time-
At design time, just go to the Solution Explorer -> References Folder -> System.Web.Mvc. Right click on System.Web.Mvc, go to the property and see the version of the current project.
The second way to find the current MVC project is by using reflection at the runtime code. Go to Controller folder, open HomeController.cs file. In HomeController.cs file, there is an Index Method with return type of ActionResult. Just change the Method type from ActionResult to string and write the code, given below, into that method.
return typeof(Controller).Assembly.GetName().Version.ToString ();
Run the Application. You can see the result in Browser Window.
Conclusion
This article helps to determine the MVC Project Version at the design time and also at the runtime.