设置燮preSS警告网站 [英] Set suppress warnings for website

查看:135
本文介绍了设置燮preSS警告网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用从有数百个过时的方法警告另一家开发商的一个项目工作。在编译的DLL,我设置SUP preSS警告618(满警告编号是的 CS0618 )。

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.

推荐答案

我相信你需要在web.config中指定。另请参阅:编译元素并的 Web项目设置

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>

另一种方法是对<一个href=\"http://stackoverflow.com/questions/5275072/how-to-ignore-compiler-warning-when-using-obsolete-attribute-on-a-class-used-with\">add 的#pragma 语句的周围每个问题的方法,但如果有几百个,毛毯SUP pression很可能会更快。

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

这篇关于设置燮preSS警告网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆