The type or namespace name does not exist in the namespace 'System.Web.Mvc'

This one normally catches me when I run from IIS and the app pool for the default site is set to .NET version 2.0. When using IIS from visual studio it creates a virtual directory but still runs under the default site's app pool. If using the build in web server, right click on your web project, go to properties and make sure you're running it under the right version of .NET. On IIS check the .NET version on your app pool.

Following on from my last comment about how the project was created - are you correctly including the assemblies, as below (taken from the default web.config file generated by the MVC3 project template in VS10):

<compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
</compilation>

Clean your solution and then set the property of those files to Copy Local = True.

To set the Copy Local property to True or False

In Solution Explorer, click the Show All Files button to display the References node.

  • Open the References node for the project.
  • Right-click a reference in the References list, and click Properties. The properties associated with that reference appear in a list in the Properties window.
  • In the Properties window, change the Copy Local property to True or False.

For whatever reason, TWO of my solutions have web projects that spontaneously uninstalled asp.net MVC somehow. I installed it from Nuget and now they both work again. This happened after a recent batch of windows updates that included .net framework updates for the version I was using (4.5.1).

Edit: From the .Net Web Development and Tools Blog:

Microsoft Asp.Net MVC Security Update MS14-059 broke my build!