`

MSDN:Warning Level of Visual Studio

 
阅读更多
/warn (C# Compiler Options)
Visual Studio 2010

The /warn option specifies the warning level for the compiler to display.

otherCopy
/warn:option
Arguments
--------------------------------------------------------------------------------

option
The warning level you want displayed for the compilation: Lower numbers show only high severity warnings; higher numbers show more warnings. Valid values are 0-4:

Warning level
Meaning

0
Turns off emission of all warning messages.
[
TAG001:
emission  [i'miʃən]      
n. 发射,放射,发出,放出,排出
{hyp--Custom basic useful usages:
1.nocturnal emission
遗精,梦遗

2.infrared emission
红外发射

3.photoelectric emission
光电发射,光电子发射

4.thermal emission
热发射

5.secondary emission
次级发射,二次发射,二次排放


}
]

1
Displays severe warning messages.
[
TAG002:
severe  [si'viə]      
a. 严格的,凶猛的,严肃的,严重的,严厉的,朴素的
{hyp--Custom Basic Useful Usages:
1.Spring comes after the severe winter.
严冬过后是春天。
2.I have a severe pain in my leg.
我腿部剧烈疼痛。
3.The flood presented the province with severe problems.
洪水使该省面临种种严重问题。
4.A high fever usually indicates severe illness.
高烧通常表明生了重病。
5.To inflict severe pain on;torture.
使痛苦使受剧烈的痛苦;折磨
}
]

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 (the default)
Displays all level 3 warnings plus informational warnings.


Remarks
--------------------------------------------------------------------------------

To get information about an error or warning, you can look up the error code in the Help Index. For other ways to get information about an error or warning, see C# Compiler Errors.

Use /warnaserror to treat all warnings as errors. Use /nowarn to disable certain warnings.

/w is the short form of /warn.

To set this compiler option in the Visual Studio development environment
1.Open the project's Properties page.

2.Click the Build property page.

3.Modify the Warning Level property.

For information on how to set this compiler option programmatically, see WarningLevel.

Example
--------------------------------------------------------------------------------

Compile in.cs and have the compiler only display level 1 warnings:

otherCopy
csc /warn:1 in.cs
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics