Chuck Conway

In The craft

Ooooh the Pain -- Conditional Compilation Directives

June 19, 2011 · 1 minute read

I never use them. It does not feel right. Baking in environment specific information into your compiled code never sounded like a good idea. I want my code to behave the same way in all build configurations/environment. Development should not have code enabled that is not available to QA. That’s crazy!

If you want environment specific code use the provider model/pattern, use the web.config transformation, use a data driven configurations.

For heaven’s sake do not compile environment specific configurations into your code!

Ooooh the pain!