I have an MVC 5 application, made from the empty template. I\'ve added Microsoft.AspNet.Mvc
via Nuget and my packages file looks like so:
Closing ALL instances of Visual Studio worked for you, great.
I get this symptom periodically, but I am using Resharper, and to fix it I have to
If you have resharper , suspending it will fix i.e: Tool - Options - Resharper - Suspend
I encountered this issue and tried every solution under the sun. For a week I tried editing the web config (in both the view and the root), reloading the project, clearing resharper caches.. you name it, I tried it. I loaded up an old project and hovered over the "Layout" and "Model" sections to see what namespaces they required. On closer examination, the namespaces which were required had been removed from my project. I have no idea how - I had recently performed an upgrade.. Anyhow - I referenced these 2 files from the solution folder System.Web.Mvc and another, rebuilt, and it worked. I could have danced on the spot. Hope this helps someone down the line!
Your web.configs both look fine. Visual Studio can often get confused about things like this. My recommendation is to close Visual Studio and reopen it. Also, as you discovered, closing all open instances of VS may be required.