Export (0) Print
Expand All

/warnaserror

Causes the compiler to treat the first occurrence of a warning as an error.

/warnaserror[+ | -]

Arguments

+ | -
By default, /warnaserror- is in effect; warnings do not prevent the compiler from producing an output file. /warnaserror, which is the same as /warnaserror+, causes warnings to be treated as errors.

Remarks

Subsequent occurrences of the same warning are reported as warnings. The compiler produces no output file.

To set /warnaserror in the Visual Studio integrated development environment

  1. Open the project's Property Pages dialog box. For details, see <Projectname> Property Pages Dialog Box.
  2. Click the Configuration Properties folder.
  3. Click the Build property page.
  4. Modify the Treat compiler warnings as errors property.

To set /warnaserror programmatically

  • See TreatWarningsAsErrors Property.

Example

The following code compiles in.vb and directs the compiler to display an error for the first occurrence of every warning it finds:

vbc /warnaserror in.vb

See Also

Visual Basic Compiler Options | Sample Compilation Command Lines

Show:
© 2014 Microsoft