This documentation is archived and is not being maintained.

WarningLevel Property

Visual Studio .NET 2003

Selects how strict you want the compiler to be about checking for potentially suspect constructs. Exposes the functionality of the C++ compiler's /W option and the MIDL compiler's /W option.

[Visual Basic .NET]
Public Property WarningLevel() As warningLevelOption
[Visual Basic 6]
Property Get WarningLevel() As warningLevelOption
Property Let WarningLevel( _
   ByVal NewValue As warningLevelOption _
HRESULT __stdcall get_WarningLevel(
   /* [out, retval] */ warningLevelOption* retVal
HRESULT __stdcall put_WarningLevel(
   /* [in] */ warningLevelOption NewValue
public warningLevelOption WarningLevel {get; set;}
[JScript .NET]
public function get WarningLevel() : warningLevelOption
public function set WarningLevel(
   NewValue : warningLevelOption


Use the warningLevelOption enumeration to change the value of the VCCLCompilerTool property.

Use the midlWarningLevelOption enumeration to change the value of the VCMidlTool property.


The following sample code modifies the compiler's WarningLevel property in the development environment:

' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub Test()
        Dim prj As VCProject
        Dim cfgs, tools As IVCCollection
        Dim cfg As VCConfiguration
        Dim tool As VCCLCompilerTool
        prj = DTE.Solution.Projects.Item(1).Object
        cfgs = prj.Configurations
        cfg = cfgs.Item(1)
        tool = cfg.Tools("VCCLCompilerTool")
        tool.WarningLevel = warningLevelOption.warningLevel_0
    End Sub
End Module

See Samples for Project Model Extensibility for information on how to compile and run this sample.

See Also

Applies To: VCCLCompilerTool Object | VCMidlTool Object