This seems to be a common problem, MVC razor views loose their intellisense in Sitecore projects.
Here are some tips to get this fixed:
1) If you use Resharper you will need to change the intellisense settings under Resharpers Options menu to use Visual Studio intellisense for HTML files (as in the image below)
2) Some people like to turn copy local to false for the references in their Visual Studio project; I do this to reduce build times and to not package dll’s that are part of the Sitecore install. This can cause problems, as Intellisense needs the relevant dll’s to be in the bin folder.
Also, if you’ve setup sub-folders for different build configs in your bin folder (e.g. bin\debug) Intellisense will be lost, as it expects these dll’s in the root of bin.
I’ve got around this all adding a Post Build event to my MVC project to copy the relevant dll’s from a “MVCIntellisense” folder in the root of my solution to the root of bin:
copy /Y “$(SolutionDir)MVCIntellisense" ”$(ProjectDir)bin"
The bare minimum dll’s you would need are:
- Sitecore.Kernal
- Sitecore.MVC.Analytics
- Sitecore.MVC
- System.Web.MVC
- System.Web.Optimization
- System.Web.WebPages
3) Copy the web.config that sits in your Sitecore website’s Views folder into the Views folder of your Visual Studio solution.
4) Check that the project .csproj file is set to the right version of Visual Studio. I had a weird scenario where Intellisense was working is VS 2013, but not in VS 2015. To check this, open the .csproj file in notepad and look at the tools version used, e.g.
<Project ToolsVersion=“14.0” >
If you are still having problems there are a few resources online with other fixes, this was what worked for me in Visual Studio 2015.