如何抑制来自特定 dll 的警告
我在我的项目中添加了不符合 CLS 的第 3 方 Lotus Notes dll。我需要设置“将警告视为错误”。如何仅抑制来自该特定 dll 的所有警告。
所有警告都像
Identifier 'Domino.Name_Of_Identifier' is not CLS-compliant
I am adding 3rd party Lotus Notes dll in my project which is not CLS-Compliant. I need to set 'Treat Warning As Error'. How can I suppress all the warnings from that particular dll only.
All warnings are like
Identifier 'Domino.Name_Of_Identifier' is not CLS-compliant
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用
#pragma 在本地禁用警告警告
禁用公共语言规范警告,请使用以下警告编号:
40025, 40026, 40027, 40028
或者,您可以使用以下方法将您的类或程序集标记为不符合 CLS
CLSCompliantAttribute
,但在这种情况下,我想这就像用枪射苍蝇一样。You can disable warnings locally with
#pragma warning
To disable Common Language Specification warnings, use the following warning numbers:
40025, 40026, 40027, 40028
Alternatively you can mark your class or your assemlby as being non-CLS compliant using the
CLSCompliantAttribute
, but in this case I guess it would be like shooting a fly with a gun.经过一番挣扎,我找到了完美的解决方案。打开输出窗口并构建解决方案。您将看到警告。将此警告添加到 Bevan 显示的窗口中。有用。
After struggle I found perfect solution. Open Output window and build the solution. You will see the warning. Add this warning to the window shown by Bevan. It works.
您无法抑制来自特定 DLL 的警告 - 但您可以关闭特定警告。
在消息中,您将看到类似 CS3008 的数字 - 进入“项目属性”、“构建”选项卡,然后将其输入“抑制警告”字段。
You can't suppress warnings from a particular DLL - but you can turn off specific warnings.
In the message you'll see a number like CS3008 - go into Project Properties, Build Tab, and enter this into the Suppress Warnings field.