Recently installed Visual Studio 2022, and have some old style mixed code aspx files with:
<%@ Page Language="C#" %>
<script runat="server"> ...
The c# code inside the script remains uncolorized. HTML code is colorized fine. These are just one-off aspx files to be edited and not necessarily part of a VS project.
This worked fine in VS2015.
Is there a setting to enable this in VS2022?
EDIT: Thanks all for responding, but perhaps I should have mentioned that these are really old style aspx files, as in for .NET 4.
I found this link: https://learn.microsoft.com/en-us/dotnet/framework/install/guide-for-developers
Assume this is the reason for my issue. Although I don't want to build any apps in VS, just view/edit individual aspx files and have the syntax highlighted.
Starting with Visual Studio 2022, Visual Studio no longer includes .NET Framework components for .NET Framework 4.0 - 4.5.1 because these versions are no longer supported. Visual Studio 2022 and later versions can't build apps that target .NET Framework 4.0 through .NET Framework 4.5.1. To continue building these apps, you can use Visual Studio 2019 or an earlier version.
I don't believe syntax highlighting for classic asp.net files with mixed code and html is possible in Visual Studio 2022.
There's a callout box in the middle this page that sort of addresses this matter, https://learn.microsoft.com/en-us/dotnet/framework/install/guide-for-developers
Just now I installed Visual Studio 2019, opened a classic asp.net file in it and got nice syntax highlighting and color coding.
Not the ideal solution, but it's what works. Leaving it here in case someone is struggling with this issue.