添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
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

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

Ask Question

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:

  • following the advice in several other SO questions - to no avail
  • ensuring the dlls are set to copy to local
  • removing and re-adding references
  • deleting dlls from the application and adding them back
  • cleaning and rebuilding the application
  • restarting the application and my computer
  • What would cause this? How do I eliminate it?

    This is perhaps due to the heavy tasks which VS2015 do in background all the time and it cannot handle the big scope of your project. Try to reduce the amount of files in the project if there are too many. – Ian Feb 25, 2016 at 1:42 Have you tried restarting visual studio? Have you moved any files around from one folder to another? – ProgrammingDude Feb 25, 2016 at 2:04 In that long list, try to scroll lower to things that look more like "real errors" (syntax, etc.). Also you may have updated a package in one project and not in related projects (mismatch). If all else fails, and the errors simply don't make sense , push that nuke button and simply restart VS (yes, I meant that, it's not a joke)...Hth. – EdSF Feb 25, 2016 at 2:04 Unbelievable, restarting Visual Studio was indeed the answer. Had been wrestling with this for over 3 hours. Visual Studio Community 2015 update 3 with .NET framework 4.6.01055. System.Web.Mvc version is 5.2.3 – Manish Feb 1, 2017 at 12:19 I have other MVC solutions that continue to work just fine, so I don't think it is an issue with MVC. I have tried all the others previously. – davids Feb 25, 2016 at 13:58 It's usually not a issue that affects all MVC applications, rather your solution file has somehow had a path or config messed up that has broken the project. If you have tried these steps including the re-install of MVC from nuget then i am our of ideas sorry. – Nick Feb 26, 2016 at 7:53 Works for me, I had to force remove nuget package for MVC, Razor, and WebPages and reinstall them. After that it worked. For me it was not an issue with the machine, several machines had that issue. – Harvey Darvey Sep 13, 2017 at 15:48 I am getting the same error in my project, structure is, 1 project i have edmx and getting reference in another one Web project. is error related to the structure? or anything else? i have follow the same step which you mention but still facing the same issue. @Nick – Nirav Vasoya Jun 3, 2019 at 3:40

    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
            

    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.