Visual studio 2017 cshtml syntax highlighting not working

Viewed 9238

I have been using VS 2015 for quite some time and just moved to 2017 recently. My cshtml text is all one color (black) and I have been trying to figure out why they are not highlighting like my other file types. Any ideas? This is pretty frustrating as I have been through different settings and many posts looking for an answer. I must be missing something.

4 Answers

Select all (Ctrl+A) and Copy(Ctrl+C) everything in the .cshtml file. Delete everything! Save (Ctrl+S) the empty file. Then paste (Ctrl+P). Worked for me!

This can also happen (and I have tested it with several machines) when VS 2017 does not have access to the installation cache. Somtimes one would like to download the installer files and keep the workload layout after installation; you then need the cache available somewhere. You may move the installation cache to a drive of your choice but remember that system and administrator must have access (everyone read access), and modify the registry setting to reflect the relocation of the files: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\Setup There you set CachePath to your new path and it will be alright. Hope this helps

Related