Udostępnij za pośrednictwem


How to: Enable or Disable Compiler Warnings (Visual Basic)

The Visual Basic compiler can detect potential problems in your code and issue warnings so that you can review them. By default, all compiler warnings are added to the Task List during compilation. You can change the behavior of the compiler so that it does not issue warnings, or so that it will treat warnings as compilation errors that must be fixed immediately.

Compiler warnings can be enabled or disabled in the Compile page of the Project Designer.

Note

Enabling or disabling certain compiler warnings may also change the value of the Option Strict property. For more information, see How to: Set Compiler Options (Visual Basic).

To disable all compiler warnings

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

  2. Click the Compile tab.

  3. Select the Disable all warnings check box.

To disable a single compiler warning

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

  2. Click the Compile tab.

  3. In the Warning configurations table, set the Notification value for the warning to None.

To treat all compiler warnings as compilation errors

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

  2. Click the Compile tab.

  3. Select the Treat all warnings as errors check box.

To treat a single compiler warning as a compilation error

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

  2. Click the Compile tab.

  3. In the Warning configurations table, set the Notification value for the warning to Error.

See Also

Tasks

How to: Set Compiler Options (Visual Basic)

Reference

Compile Page, Project Designer (Visual Basic)

Build Page, Project Designer (C#)

Other Resources

Managing Compilation Properties