I am trying to suppress specific compiler warnings, namely System.Data.OracleClient.OracleConnection' is obsolete
. I came upon these questions here:
How to disable specific warnings for the entire solution?
Globally suppress c# compiler warnings
...but they don't seem to apply to VS2013. When I go to my project's properties, I don't see a Build
tab. I see a Compile
tab, but it doesn't appear to have a place to specify warning messages to suppress. I see a section there called Warning configurations
, but I don't see the warning I am looking for.
Update: It turns out that I am trying to do this for VB.NET. Thanks to a link provided by the selected answer, you have to edit the project file's XML and supply the warning code in the <NoWarn></NoWarn>
tag. However, you have to know the warning code which is hidden in the error list. One way to get it is to open the output window and build the project. In my case, the warnign code is 40000
. It shows as BC40000
, but I had to remove the BC
. After rebuilding the project, the warning messages went away.
To suppress specific warnings for Visual C# or F#:
Check out here for more info on how to suppress specific warning for Visual C++ and Visual Basic.
Another ways is to use #pragma warning
can enable or disable certain warnings.:
#pragma warning disable warning-list
#pragma warning restore warning-list
warning-list
A comma-separated list of warning numbers. Enter the numbers alone, without the "CS" prefix. When no warning numbers are specified, disable disables all warnings and restore enables all warnings.