There are two ways to determine the versions installed in your machine.
At design time
During designing, go to “Solution Explorer." Right click on it and expand the “References” folder. Right click on “Web.MVC” assembly. Then, select “Properties” where you can find the versions.
Please refer to the below images.
The above blue mark represents the version 4.0.0.0 of MVC installed in our machine.
At Runtime
During Runtime we can use the below lines of code to find the version of MVC installed.- typeof(controller).Assembly.Getname().Version.Tostring();
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.MVC;
- namespace MVC3Application.Controller {
- public class HomeController: Controller {
- public string Index() {
- return typeof(controller).assembly.Getname().Version.Tostring();
- }
- Public ActionResult About() {
- return view();
- }
- }
- }
Please refer to the below image.
If we run this above line of code, we will get the MVC version installed in our machine. Please refer to the below screenshot.
The blue mark indicates the version installed in your machine.