Search code examples
visual-studio-2022

Visual Studio how to enable hints for #if #endif block


For example when I type in MAUI Visual Studio I have colored, hints like this enter image description here

but When I use #if #endif I don't have this one

enter image description here

How to enable this one?

I have Visual Studio 2022. I tried find some settings in Properties but ...) Is it impossible?

Help me please)


Solution

  • Your code inside conditional compilation block is shown as grey since they won't be compiled as WINDOWS is not defined in your project. Platform symbols are available only when you are on .NET 5+(and .NET Core) and have specified an OS-specific TFM,such asnet5.0-windows in your project file.