Share via


How to: Set Compilation Constants (Visual Basic)

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 Conditional Compilation in Visual Basic.

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

Reference

Advanced Compiler Settings Dialog Box (Visual Basic)

Build Page, Project Designer (C#)

Other Resources

Managing Compilation Properties

Conditional Compilation in Visual Basic