Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razor Syntax Highlighting

I have a fairly large ASP MVC project which I am running in visual studio 15.4.5. Whenever I view .cshtml files Visual Studio incorrectly highlights the file for example:

enter image description here

  • We are making use of compiled razor views.
  • The project compiles and runs correctly

What I've tried

  • Deleting all bin, obj & .vs folders
  • Running .\devenv.exe /ResetUserData
  • Running .\devenv.exe /UpdateConfiguration & .\devenv.exe /ClearCache
like image 361
Darren Avatar asked Jan 04 '23 02:01

Darren


1 Answers

I found this question whilst trying to solve the nuisance that is the highlighting myself so thought I'd share my findings. Apparently this is the intentional behaviour as it referred to as "Razor Syntax Highlighting" and through both this post on MSDN and another question on here: How do you turn off Razor highlighting in VS 2013? I was able to determine how to turn it off on my machine.

Quote from MSDN post:

This highlighting is the built in support for Razor syntax highlighting. If you do not like it, you can open your .cshtml files in Visual Studio using the HTML editor

Screenshot of what I changed that worked for me:

screenshot of options dialog

like image 90
talegna Avatar answered Jan 11 '23 13:01

talegna