Today I had to deal with a nasty issue that happened on my Visual Studio 2017 Enterprise Edition, right after installing the VS2017 15.8.1 update. In a nutshell, I had lost intellisense and syntax highlighting / coloring for all my .cshtml files. All other file types (CSS, JS, HTML, etc.) were working fine.
Luckily enough, I ran into this great post from the Visual Studio Community (god bless communities) which pointed me the right direction to fix my issue.
Here's what you need to do:
- Close all the open/active instances of Visual Studio 2017.
- Start the Visual Studio Installer tool.
- Locate the VisualStudio 2017 instance that's causing the problem (I had 2 on my system: the Community Edition, which worked fine, and the Enterprise Edition, that was affected by the problem).
- Click the Modify button. A list of the installed software & add-on packages will appear.
- Locate the package called ASP.NET and Web Development and uncheck it, then click the Modify button to have it uninstalled (!)
- Right after that, click again the Modify button.
- Locate again the ASP.NET and Web Development package and check it, then click the Modify button to install it from scratch.
Once done, launch Visual Studio 2017: if everything went well, your Razor pages will now have proper Intellisense and syntax coloring.
That's it! I sincerely hope that this workaround will help many ASP.NET developers who have experienced this nasty Visual Studio 2017 issue.