Intellisense does not work in razor files:
In my web.conifg file (in the Views folder) is apparently correct:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.Optimization" />
<add namespace="MvcSiteMapProvider.Web.Html" />
<add namespace="MvcSiteMapProvider.Web.Html.Models" />
<add namespace="DevTrends.MvcDonutCaching" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="BlockViewHandler" />
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>
In my case, none of the aboves worked, here is what I did to resolve my problem:
Load the project with VS and leave it, and then open the your-project-name.csproj with Notepad++ or whatever the Text editor you like and made some changes, like delete a Content tag(Don't worry, it will be back once you reinclude it in VS Solution Explorer), once you save your changes, the Visual Studio IDE will detect your changes and ask you for reloading the whole project, click on 'Yes' and my code IntelliSense back.
I'm using: Microsoft Visual Studio Professional 2019 Preview Version 16.3.0 Preview 2.0
Hope it helps.
I was experiencing this in Visual Studio 2013 after upgrading the project to MVC 5.2.3. The thing that worked for me was replacing the web.config in the "Views" folder with the following, since the NuGet package left that web.config with many MVC 4.0 references.
My project was upgraded from VS2012 to VS2013 and this solved the problem for me:
Change "webpages:Version" in the Web.config file from "1.0.0.0" to "2.0.0.0"
Watch out if you have areas in your web application, there's yet another Web.config file in the Areas/Views folder and in my case this configuration file was the culprit.
Also, you may have to restart Visual Studio after making the changes to Web.config, rebuilding the solution doesn't seem to pick up the changes, at least it didn't for me.
One cause for this could be if your wepages are set to version 3 for an mvc4 application, you can just change it to version 2 in the web.config app settings.
I had the same issue. Although I'm using VS 2012, there is a download that applies to both VS 2013 and VS 2012. I've tried quite a few fixes (having to do with web.config, uninstalling/reinstalling MVC via NuGet, etc) but the only one that worked for me was installing this (again, for me, for VS 2012)
VS 2013 with ASP.NET and Web Tools 2013.1 http://www.asp.net/downloads