Visual Studio warning level meanings?

2019-01-18 00:57发布

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.

5条回答
霸刀☆藐视天下
2楼-- · 2019-01-18 01:32

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.
查看更多
Rolldiameter
3楼-- · 2019-01-18 01:34

You can check Microsoft's levels here. Level 0 is essentially none while level 4 will be the most strict.

查看更多
孤傲高冷的网名
4楼-- · 2019-01-18 01:39

For example setting a warning level to 4 or /W4 means the compiler will treat all warnings as errors. It's mostly how the compiler reacts when it sees something that it doesn't feel good about. And, by the way, a level of 0 turns of all warnings.

查看更多
Summer. ? 凉城
5楼-- · 2019-01-18 01:41

0 turns off warnings completely, while 4 is the most verbose level. See the documentation here which has the same warning levels.

查看更多
虎瘦雄心在
6楼-- · 2019-01-18 01:48

Higher is stricter. It can be annoying to see all the warnings that may or may not mean much to your app, but taking the time to clear them up can teach you a lot.

查看更多
登录 后发表回答