The type or namespace name 'Mvc' does not exist

asp.net MvcVisual Studio-2013

asp.net Mvc Problem Overview


I have recently installed visual studio 2013. After downloaded a sample project from web, while i run it, it gives me the following errors-

The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)	

How to overcome this error?

asp.net Mvc Solutions


Solution 1 - asp.net Mvc

The source of your error may be that you do not have a reference to the MVC framework library. A simple solution is to add this reference trough Nuget. The MVC library will be installed in your bin directory and, if needed, all the references will be added to your project.

Either browse for the MVC package (Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution) or install it using the Nuget console (Tools -> Nuget Package Manager -> Package Manager Console) by entering Install-Package Microsoft.AspNet.Mvc. You can find additional information on the official Nuget page for AspNet.Mvc.

Solution 2 - asp.net Mvc

My solution was to simply open up the nuget package manager console and run the command update-package -reinstall Microsoft.AspNet.Mvc

Solution 3 - asp.net Mvc

Sometimes the package version conflict becomes an issue where if you have the MVC package installed then it shows the namespace error.

Here is how I solved it:

  • Open Package Manager Console (Tools > NuGet Package Manager > Package Manager Console)
  • Type uninstall-package Microsoft.AspNet.Mvc
  • Type install-package Microsoft.AspNet.Mvc

So this will give your package a fresh start, you will have all new MVC references and no errors.

Solution 4 - asp.net Mvc

Including MVC controller and Model in the project resolved the issue.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questions.k.paulView Question on Stackoverflow
Solution 1 - asp.net MvcAndrei VView Answer on Stackoverflow
Solution 2 - asp.net MvcJason EvansView Answer on Stackoverflow
Solution 3 - asp.net MvcnoobprogrammerView Answer on Stackoverflow
Solution 4 - asp.net MvcAashish MalviyaView Answer on Stackoverflow