Search code examples
c#visual-studiovisual-studio-2017preprocessorconditional-compilation

Greyed out C# preprocessor directives in Visual Studio 2017


In Visual Studio 2017, how do you stop C# preprocessor directives (#if etc.. ) from greying out the code, and ideally also allow all blocks to be Code-Completed, refactored, etc.

An answer for VS 2005 does not work with 2017..


Solution

  • This functionality was removed from Visual Studio 2017, but was restored since Visual Studio 2019

    It can be enabled at: Tools > Options > Text Editor > C/C++ > View > Inactive Code > Show Inactive Blocks