title: ASP.NET MVC 4 Project - Razor intellisense has been lost
body: <p>I've recently updated an ASP.NET MVC project from v3 to v4, and now my .cshtml Razor views have lost intellisense when edited in Visual Studio. Keywords and helper properties such as @model, @Url, @Html etc. are not being recognised and are producing errors in VS. When ran, the app itself works fine.</p>
  
  <p>I've tried suggested solutions from various online sources, including SO, most of which involve tweaks to the web.config. I've been over them and I'm pretty sure my config settings are correct for MVC 4:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;configSections&gt;
          &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
              &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
              &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
          &lt;/sectionGroup&gt;
  &lt;/configSections&gt;
  
  &lt;system.web.webPages.razor&gt;
      &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
         &lt;namespaces&gt;
             &lt;add namespace="System.Web.Mvc" /&gt;
             &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
             &lt;add namespace="System.Web.Mvc.Html" /&gt;
             &lt;add namespace="System.Web.Optimization"/&gt;
             &lt;add namespace="System.Web.Routing" /&gt;
         &lt;/namespaces&gt;
      &lt;/pages&gt;
   &lt;/system.web.webPages.razor&gt;
  
  &lt;appSettings&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
  &lt;/appSettings&gt;
  
  &lt;system.web&gt;
      &lt;httpHandlers&gt;
          &lt;add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/&gt;
      &lt;/httpHandlers&gt;    
      &lt;pages
      validateRequest="false"
      pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
      pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
      userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
          &lt;controls&gt;
              &lt;add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /&gt;
          &lt;/controls&gt;
      &lt;/pages&gt;    
  &lt;/system.web&gt;
  
  &lt;system.webServer&gt;
      &lt;validation validateIntegratedModeConfiguration="false" /&gt;
  
      &lt;handlers&gt;
         &lt;remove name="BlockViewHandler"/&gt;
         &lt;add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /&gt;
      &lt;/handlers&gt;
  &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Now, I have made some observations which give me an inkling what the problem might be. If I go through my web.config and revert the references to MVC 3, i.e. MVC from version 4.0 to 3.0, and Razor/WebPages from 2.0 to 1.0, my view intellisense comes back (but obviously this leaves me with a non-functioning app).</p>
  
  <p>I think I may possibly have an installation issue and Visual Studio, for whatever reason, is unable to locate the assemblies specified in the web.config for the purposes of Razor intellisense. I installed the ASP.NET MVC 4 reference via NuGet, and I've double-checked that all my referenced assemblies are the correct version. I've tried re-installing the MVC package and I've tried cleaning and rebuilding several times.</p>
  
  <p>Thanks in advance for any suggestions as to how I can get this working. It's really hampering my productivity at the moment.</p>