I'm getting a rather strange error, which seems to have started when I updated several NUGET packages (including to MVC 5). In my "_Layout.cshtml" file, I now get the error messages that you can see in this picture (sorry, I'm too new to post it directly here yet).
These are listed as errors, not warnings. Yet my build succeeds and the project runs, and as far as I can tell it works fine. I only see these errors when I have the "_Layout.cshtml" file open. It's acting as though it can't see "System.Web.Optimization". However, if I hover over the line, it will prompt me to insert that text and make it say:
The most likely cause of this issue is that the web.config in your Views folder(s) is/are broken. Upgrading the ASP.NET MVC 5 requires quite a few configuration changes that I am not certain the NuGet package manager does (or does well, I think it takes care of a few of these). Along with the MVC 5 .dll, many of the other related assemblies also need to be updated and the related references updated as well.
Take a look at the following tutorial and ensure you have completed EACH of the required steps. Then do a clean, rebuild and see if your issues are resolved.
I have found that it is sometimes better to have VS create a new MVC project, then look at and compare the web.configs (both application root as well as the views folder web.config) that it generates to your project's configuration files to ensure that you are not including namespaces that don't belong and all version numbers are correct.