Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set suppress warnings for website

I am working with a project from another developer that has hundreds of obsolete method warnings. In the compiled dlls, I set suppress warnings 618 (the full warning number is CS0618).

Is there a way to set the same setting on a web site?

The problem is that there are so many obsolete warnings that I can't find any of the important ones.

like image 599
yakatz Avatar asked Aug 15 '11 16:08

yakatz


1 Answers

I believe you need to specify this in the web.config. See also: Compiler Element and Web Project Settings

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp"
        extension=".cs"
        type="Microsoft.CSharp.CSharpCodeProvider, System, 
          Version=2.0.3600.0, Culture=neutral, 
          PublicKeyToken=b77a5c561934e089" 
        compilerOptions="/nowarn:618"/>
    </compilers>
  </system.codedom>

An alternative would be to add #pragma statements around each of the offending methods, but if there are hundreds, the blanket suppression would probably be quicker.

#pragma warning disable 612, 618
[Obsolete("Use something else instead")]
#pragma warning restore 612, 618
like image 77
David Ruttka Avatar answered Oct 07 '22 22:10

David Ruttka