MSBuild Condition for Design-Time and Compile-Time
I guess it is called Metaprogramming. I know there is Fody, but IL is not easy and I think debugging could get hard. But honestly I have never used it, so I may be wrong. Metalama is propriotary and Source Generators are limited.