[asp.net-mvc] CS0234: Mvc does not exist in the System.Web namespace

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, Published by Wiley Publishing, Inc. (ISBN: 978-0-470-38461-9). I also followed this blog. Now I can add Controllers, Views, etc. All the references are set properly. No build errors. But upon launching the converted project, I got compilation errors. I have mvc3 installed on the same machine. I even changed the reference to that. It still complain. Could you help? Thanks.

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

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

Source Error:

Line 109:            <namespaces>
Line 110:                <add namespace="System.Web.Helpers"/>
Line 111:                <add namespace="System.Web.Mvc"/>
Line 112:                <add namespace="System.Web.Mvc.Ajax"/>
Line 113:                <add namespace="System.Web.Mvc.Html"/> 

Source File: c:\Users\Jon\Documents\Visual Studio 2012\Projects\CMT\Apps\Branches\3.0\Web.config    Line: 111 

This question is related to asp.net-mvc asp.net-mvc-4

The answer is


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:

  1. Set it False
  2. Set it True again
  3. Rebuild

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.


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.


add Microsoft.AspNet.Mvc nuget package.


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


None of previous answers worked for me.

I noticed that my project was referencing another project using the System.Web.Mvc reference from the .NET Framework.

I just deleted that assembly and added the "Microsoft.AspNet.Mvc" NuGet package and that fixed my problem.


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>