全球燮preSS C#编译器警告 [英] Globally suppress c# compiler warnings

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

问题描述

在我的应用我有一个相当数量的具有哪些越来越通过反射设置其值的字段的实体。 (在这种情况下的NHibernate是设置它们)。我想摆脱的X从未分配,将始终有它的默认值0的警告,这样我就可以更方便地挑选出对方的警告。我知道你可以围绕他们编译指令,但据我所知,你必须为每一个做到这一点。是否有一个项目范围或解决方案广阔的道路我能做到这一点?

In my app I have a fair number of entities which have fields which are getting their values set via reflection. (In this case NHibernate is setting them). I'd like to get rid of the "x is never assigned to and will always have its default value 0" warnings, so I can more easily pick out the other warnings. I realize you can surround them in pragma directives, but AFAIK you have to do this for each one. Is there a project wide or solution wide way I could do this?

推荐答案

使用C#的命令行选项/ nowarn <一个href=\"http://msdn.microsoft.com/en-us/library/7f28x9z3(VS.80).aspx\">http://msdn.microsoft.com/en-us/library/7f28x9z3(VS.80).aspx

Use the C# commandline option /nowarn http://msdn.microsoft.com/en-us/library/7f28x9z3(VS.80).aspx

到Visual Studio转到项目中做到这一点属性 - >建设 - >(错误和警告)燮preSS警告,然后指定一个逗号分隔的警告列表,它必须SUP pressed。

To do this within visual studio goto Project properties->Build->(Errors and warnings) Suppress Warnings and then specify a comma separated list of warnings which need to be suppressed.

这篇关于全球燮preSS C#编译器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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