Does a C# preprocessing tool exist?

前端 未结 5 1541
南旧
南旧 2021-01-05 11:27

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

5条回答
  •  余生分开走
    2021-01-05 11:49

    I'm not aware of a preprocessor for C# that would allow you to export a subset of your source code without building it.

    However, You should be able to achieve the same effect by using a code generation template. Just change to the preprocesor directives to the appropriate template equivalent.

    Visual Studio 2008 has a built-in code generation tool called T4. There are other third-party options like CodesmithTools or the free MyGeneration.Net

提交回复
热议问题