简体   繁体   中英

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

Whenever I try to compile my VS2015 application, I a long list of errors like:

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

However, as soon as I double click the error to view the file, it opens the file, has a slight delay, then clears ALL the errors.

If I proceed to try and build again, I get the same list of errors and the process repeats itself.

UPDATE I forgot to mention that I have tried:

  1. following the advice in several other SO questions - to no avail
  2. ensuring the dlls are set to copy to local
  3. removing and re-adding references
  4. deleting dlls from the application and adding them back
  5. cleaning and rebuilding the application
  6. restarting the application and my computer

What would cause this? How do I eliminate it?

  • Restart Visual studio
  • Remove the assembly reference and re-add it
  • Do a clean and re-build
  • Try install Microsoft.AspNET.MVC from nuget package manager

in my case it worked only after I run in the Package Manager Console following command

PM> Install-Package Microsoft.AspNet.Mvc

My environment was:

1) Visual Studio 2017
2) Freshly created Angular 4 app
3) MVC 6 as a back end

尝试下载并将 System.Web.Mvc.dll 复制到您的项目 bin 文件夹中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM