开发者

Set suppress warnings for website

开发者 https://www.devze.com 2023-03-28 09:59 出处:网络
I am working with a project from anot开发者_StackOverflow社区her developer that has hundreds of obsolete method warnings. In the compiled dlls, I set suppress warnings 618 (the full warning number is

I am working with a project from anot开发者_StackOverflow社区her 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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消