Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio warning level meanings?

On the build tab in a Web Application project I have a setting called "Warning Level". I can set a value from 0 to 4. What do these values mean? Will a value of 0 be more strict and generate more warnings, or vice versa? I haven't been able to find any documentation on it yet, but perhaps I'm looking in the wrong place.

like image 303
Jon Tackabury Avatar asked Mar 13 '09 18:03

Jon Tackabury


People also ask

What are warnings in code?

Compiler Warnings. Unlike compiler errors, which indicate actual language violations that prevent the compiler from fully processing the source code, warnings indicate that something doesn't seem quite right with our code even though it may be syntactically correct.

How do I enable warnings in Visual Studio?

If you want to turn it on (or off) in the project setting, you have to go to: Configuration Properties -> C/C++ -> Command Line and then under Additional Options you can enter: /w3#### to set your warning to level 3, and thus enable it; or you can enter /wd#### to disable a warning.

How do I get rid of warning treatment as error in Visual Studio?

Turn off the warning for a project in Visual StudioSelect the Configuration Properties > C/C++ > Advanced property page. Edit the Disable Specific Warnings property to add 4996 . Choose OK to apply your changes.


1 Answers

This link shows you the definitions of the warning levels (I'm assuming you are using C# code in your web project). Level 4 is the most strict.


  • 0: Turns off emission of all warning messages.
  • 1: Displays severe warning messages.
  • 2: Displays level 1 warnings plus certain, less-severe warnings, such as warnings about hiding class members.
  • 3: Displays level 2 warnings plus certain, less-severe warnings, such as warnings about expressions that always evaluate to true or false.
  • 4: Displays all level 3 warnings plus informational warnings. This is the default warning level at the command line.
  • 5: Displays level 4 warnings plus additional warnings from the compiler shipped with C# 9.0.

Anything greater than 5 is treated as 5.

like image 167
mwigdahl Avatar answered Oct 12 '22 17:10

mwigdahl