Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

I'm trying to create a new constant so I can use it in a similar way as the DEBUG constant:

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

That works for Debug / Release configurations in Visual Studio 2008, but what I need is a TDD or TESTING constant. I created a new build configuration named "Testing". Now the question is how I define that.

Must be some command line parameter ::- ).

Thank you in advance ::- ).

like image 360
Axonn Avatar asked Jul 25 '10 18:07

Axonn


1 Answers

In the Project Properties window, Build tab, there is a textbox that lets You enter 1 or more values:

Conditional Compilation Symbols: [TESTING;DEMO      ]

As you will see it is bound to the Configuration selection.

like image 169
Henk Holterman Avatar answered Nov 10 '22 02:11

Henk Holterman