Using preprocessor directives in with VS 2022 and C# makes code lose syntax coloring and squiggles

Viewed 318

I am creating a class library that targets dotnet standard 2.1 and dotnet framework 4.6. I am trying to use pre-processor directives to mark code that is framework specific, but I am losing colors and error highlighting. But only in between the NETSTANDARD2_1 blocks.

How can I fix this? I am using Visual Studio 2022 Preview 4.

Difference between NET46 and NETSTANDARD2_1 pre-processor directives

1 Answers

This thing is the navigation bar. I never knew that's what it was called. You can drop this down and select the different framework contexts and your code will then be color highlited. enter image description here

Related