5

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?

5
  • 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. Commented Feb 25, 2016 at 1:42
  • 2
    Have you tried restarting visual studio? Have you moved any files around from one folder to another? Commented Feb 25, 2016 at 2:04
  • 1
    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. Commented Feb 25, 2016 at 2:04
  • Your web.config references might be incorrect. Re downloading nuget packages may fix Commented Feb 25, 2016 at 4:01
  • 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 Commented Feb 1, 2017 at 12:19

3 Answers 3

10
  • 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
Sign up to request clarification or add additional context in comments.

4 Comments

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.
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.
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.
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
2

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

Comments

-1

try download and copy System.Web.Mvc.dll into your project bin folder

1 Comment

From where? It is also not best practice to copy paste DLLs around. You should try and solve the issue so that this fix is not necessary in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.