Using C#, Visual Studio 2010.
There is a namespace called System.Web.Mvc documented on MSDN. The documentation for all the types in that namespace says that they are in System.Web.Mvc.dll
.
However, when I go to Add Reference, “.NET” tab, this assembly is missing from the list. Why?
Best way is to use NuGet package manager.
Just update the below MVC package and it should work.
It should be there. By default the add references list seems to be ordered, but its not the case. Hit the name header and look again.
I have had the same problem and here is the funny reason: My guess is that you expect
System.Web.Mvc
to be located underSystem.Web
in the list. But the list is not alphabetical.First sort the list and then look near the
System.Web
.I believe you'll find the MVC assembly is referenced in the web.config file, not in the project itself.
Something like this:
To respond to your comment;
The best answer I can give is from here:
Check these step:
Note: if target framework is set to .Net Framework 4 Client Profile, it will not list MVC reference on references list. You can find different between .Net Framework 4 and .Net Framework 4 Client Profile here.
If you got this problem in Visual Studio 2017, chances are you're working with an MVC 4 project created in a previous version of VS with a reference hint path pointing to
C:\Program Files (x86)\Microsoft ASP.NET
. Visual Studio 2017 does not install this directory anymore.We usually solve this by installing a copy of Visual Studio 2015 alongside our 2017 instance, and that installs the necessary libraries in the above path. Then we update all the references in the affected projects and we're good to go.