Global conditional symbols in C#

Recently, I got slightly different questions from folks who weren't aware of the /define command-line compiler option in C#. The thinking was they needed to define a conditional-symbol (in specspeak) defined for their entire project and, to do so, they had to add the following to each of their source files to make sure it was defined everywhere:

#define myconditionalsymbol

The better (and much easier) way to do this is to define the conditional symbol to the compiler when you compile the code. An example of a command-line that does this follows:

csc /define:myconditionalsymbol source.cs

You can also achieve this via the Visual Studio IDE. In VS 2003 (aka v7.1 or Everett), you go to the project's properties -> Configuration Properties -> Build -> Conditional Compilation Constants. You'll find a semi-colon separated list there that you can add your own symbols to. In VS 2005 (aka 8.0 or Whidbey), it's in project properties -> Build -> Conditional Compilation Symbols.