Does anyone know of a utility to preprocess a C# source file without compiling it, in a similar fashion to using the -E flag in GCC? I tried using GCC - it successfully proc
I faced this some time ago - had to clean up certain outdated C# preprocessor branches in my old project leaving relevant branches intact. The built-it C preprocessor could not do it for me as its output file never contains preprocessor directives. Of course, there are C processor tools such as unifdef or coan that can partially remove outdated branches for C/С++. The thing is that they do not fully support С# syntax - they fail on #region and #pragma, for instance. So, I had to write my own python tool undefine for my task. I used regexp for parsing directives and the sympy library - for simplifying and calculating logical expressions. To resolve your task try the following:
>>python undefine apply -d SUBPROJECT your_project_path
The tool worked fine with my large ~10m lines codebase.