相关文章推荐
纯真的石榴  ·  [Solved] ...·  1 年前    · 
跑龙套的圣诞树  ·  Visual Studio Code / ...·  1 年前    · 
聪明伶俐的铁板烧  ·  Node.js ...·  1 年前    · 
体贴的弓箭  ·  el-table ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

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.

Make sure you select a Version that is compatible with your project .NET framework version. – live-love Jan 10, 2017 at 15:39

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.

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.