How to define a constant globally in C# (like DEBUG)

前端 未结 4 811
野性不改
野性不改 2020-12-18 20:13

I want to compile a project differently, according to a constant defined by #define, like this:

#define USE_COMPONENT_X

#if USE_COMPONENT_X
...

#endif
         


        
4条回答
  •  佛祖请我去吃肉
    2020-12-18 20:54

    You can add the /define compiler switch.

    1. Open the project's Property Pages dialog box.
    2. Click the Configuration Properties folder.
    3. Click the Build property page.
    4. Modify the Conditional Compilation Constants property.

提交回复
热议问题