How To Know What MVC Version Is Already Installed In Your Machine

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.

ASP.NET

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.
  1. typeof(controller).Assembly.Getname().Version.Tostring();  
  2. using System;  
  3. using System.Collections.Generic;  
  4. using System.Linq;  
  5. using System.Web;  
  6. using System.Web.MVC;  
  7. namespace MVC3Application.Controller {  
  8.     public class HomeController: Controller {  
  9.         public string Index() {  
  10.             return typeof(controller).assembly.Getname().Version.Tostring();  
  11.         }  
  12.         Public ActionResult About() {  
  13.             return view();  
  14.         }  
  15.     }  
  16. }  

Please refer to the below image.

ASP.NET
If we run this above line of code, we will get the MVC version installed in our machine. Please refer to the below screenshot.

ASP.NET

The blue mark indicates the version installed in your machine.