Visual Studio 2015 Error Opening .cshtml File

PROBLEM

You double-click a .cshtml file in Visual Studio 2015 and you get an error “Object reference not set to an instance of an object”.

SOLUTION

  1. Close Visual Studio
  2. Delete all files in the folderĀ %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
  3. Re-open Visual Studio
  4. You should now be able to open your .cshtml file