How to: Set Compilation Constants

Conditional compilation constants determine whether tracing and debugging statements should be compiled into the assembly or not.

DEBUG, TRACE and custom constants can be set in the Advanced Compiler Settings dialog box, accessible from the Compile page of the Project Designer.

Note

Additional compilation constants can be specified programmatically. For more information, see How to: Declare Conditional Compilation Constants.

To set a DEBUG constant

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.

  2. Click the Compile tab.

  3. Click the Advanced Compile Options button to open the Advanced Compiler Settings dialog box.

  4. Select the Define DEBUG constant check box, and then click OK.

To set a TRACE constant

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.

  2. Click the Compile tab.

  3. Click the Advanced Compile Options button to open the Advanced Compiler Settings dialog box.

  4. Select the Define TRACE constant check box, and then click OK.

To set a custom constant

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.

  2. Click the Compile tab.

  3. Click the Advanced Compile Options button to open the Advanced Compiler Settings dialog box.

  4. Select the Custom Constants field and enter your constants using the form Name1="Value", and then click OK. Multiple constants should be separated with commas.

See Also

Tasks

How to: Declare Conditional Compilation Constants

Reference

Conditional Compilation Constants

Other Resources

Managing Compilation Properties