Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditionally compiling entire namespaces - C#

I was wondering if there is a way to conditionally compile entire namespaces in C#. Or am I left with having to explicitly decorate each source file within the namespace with the preprocessor directives to exclude it? In sub-versions of my application the code in various namespace is simply not required and I would like it excluded.

Thanks in advance!

like image 623
Filip K Avatar asked Apr 07 '10 03:04

Filip K


1 Answers

If your namespace is in a separate assembly which doesn't contain anything else you can use the Configuration Manager for your specific sub-version and untick the "Build" check box.

If you've got other classes in the assembly though they will not be built or included obviously, and then the only way would be to decorate with pre-processor declarations.

like image 198
Michael Shimmins Avatar answered Oct 29 '22 06:10

Michael Shimmins