Visual Studio Cannot open cshtml Files

Maermot picture Maermot · Dec 8, 2015 · Viewed 11.2k times · Source

I have a problem, which I cannot solve. I can't open every cshtml-File in a Visual Studio c# mvc project (whatever which project i tried). I get the following error Msg (I try to translate to English):

Object reference not set to an instance to an object

Google says, it may be a NullReferenceExeception. But it has nothing to do with my code, because first I can execute the project successfully and second the error occurs in every project (since today).

Answer

mac10688 picture mac10688 · Dec 14, 2015

I just experienced the same issue. It just came out of nowhere, as you described. I even went through a 2 hour repair. That didn't fix it.

However, a coworker suggested this fix.

Visual Studio 2015 not syntax highlighting razor nor Intellisense

I had the same problem, the only fix so far is by resetting all user data (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /ResetUserData).

Now I am able to use the real default editing and I get good syntax highlighting again.