]> Visual Studio 2015 - Razor IntelliSense not working 🌐:aligrant.com

Visual Studio 2015 - Razor IntelliSense not working

Alastair Grant | Wed 30 Sep 2015

When editing *.cshtml files in Visual Studio 2015 I do not get any IntelliSense for Razor operators. e.g. If I type @Html. I don't get any hints come up.

In addition, rather suspiciously, when I open a *.cshtml file for the first time I receive the error

An exception has been encountered.  This may be caused by an extension.

You can get more information by examining the file

That ActivityLog file can get pretty big, so if you're going to examine it, it's probably best to delete it first and regenerate the error. In mine there was a fairly obvious error jumping out at me:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'RazorSupportedRuntimeVersion' Key being added: 'RazorSupportedRuntimeVersion'

And so on.

The proposed solution for this around the web is to run devenv /resetuserdata. This failed immediately for me as for some reason that command tried to launch Visual Studio 2010, which isn't installed. Fortunately, there is a fix for this too. That's a regedit tweak to: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe. The default value is the path to the current Visual Studio installation, so for me I just needed to replace "10.0" to "14.0" in the file path and the command worked.

Mine still popped up with "Unknown Error" during the reset process, but once I launched Visual Studio (and gone through initial setup again) it all worked as expected.


Breaking from the voyeuristic norms of the Internet, any comments can be made in private by contacting me.