I converted a ASP.net 4 webform project to Asp.net MVC4 according to Chapter 13 of the Professional ASP.NET 3.5 MVC, by Scott Hanselmen, Phil Haack, and Rob Conery, Publishe
Check your runtime tag inside the web.config, and verify you have something like this declared:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
.....
</runtime>
You need to include the reference to the assembly System.Web.Mvc in you project.
you may not have the System.Web.Mvc in your C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0
So you need to add it and then to include it as reference to your projrect
I had the same problem and I had solved it with:
1.Right click to solution and click 'Clean Solution'
2.Click 'References'
folder in solution explorer and select the problem reference (in your case it seems System.Web.Mvc) and then right click and click 'Properties'
.
3.In the properties window, make sure that the 'Copy Local'
property is set to 'True'
This worked for me. Hope it works for someone else
Helpful Note: As it has mentioned in comments by @Vlad:
If it is already set to True:
I had this problem, but all the applications in IIS were broken when they had been working previously. None of the marked solutions helped me. The problem ended up being an extra copy of web.config had been introduced to my root directory. I removed that file and problem solved.
This problem can happen when you deploy your web application to a server, so you must check if you already installed MVC3.
Check if the folder C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3
exists.
If it doesn't exist, you need to install it from http://www.microsoft.com/en-us/download/details.aspx?id=1491
If you wont to install you can add all DLLs locally in bin folder and add references to them this work fine if you host on server don't deploy ASP.NET Web Pages or MVC3.
I tried all these answers, even closed Visual Studio and deleted all bin directories.
After starting it up again the MVC reference appeared to have a yellow exclamation mark on it, so I removed it and added it again.
Now it works, without copy local.