Define a new compile-time constant in C # (for #if)

I am trying to create a new constant, so I can use it the same way as the DEBUG constant:

#if(DEBUG)
    public void LoadProcedure ()
#else
    private void LoadProcedure ()
#endif

This works for Debug / Release configurations in Visual Studio 2008, but I need the TDD or TESTING constant. I created a new build configuration called Test. Now the question is how I define it.

There must be some command line parameter :: -).

Thanks in advance :: -).

+5
source share
1 answer

In the "Project Properties" window on the "Create" tab, a text field appears that allows you to enter 1 or more values:

Symbols of conditional compilation: [TESTING; DEMO]

As you will see, it is tied to the choice of configuration.

+11
source

All Articles