79476832

Date: 2025-02-28 22:45:47
Score: 1
Natty:
Report link

The issue is Visual Studio 2022’s default Razor editor for ASP.NET Core, which can misrender themes for .cshtml files in the editor but works fine in the diff view (using a different renderer). Here’s the fix:

1. Go to Tools > Options > Text Editor > HTML > Advanced.

2. Set Razor:Use legacy Razor editor for ASP.NET Core to TRUE.

3. Restart Visual Studio.

This switches to the legacy Razor editor, making themes apply consistently to .cshtml files in the editor, matching the diff view’s vibrant look. Ensure the "ASP.NET and web development" workload is installed (Tools > Get Tools and Features).

Hope someone else finds this helpful!


Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Greg Meff