Visual Basic Compiler Options |
|
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
- Open the project's Property Pages dialog box. For details, see <Projectname> Property Pages Dialog Box.
- Click the Configuration Properties folder.
- Click the Build property page.
- 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