如何抑制来自特定 dll 的警告

发布于 2025-01-08 13:01:34 字数 185 浏览 5 评论 0原文

我在我的项目中添加了不符合 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

泼猴你往哪里跑 2025-01-15 13:01:35

您可以使用 #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.

情绪失控 2025-01-15 13:01:35

经过一番挣扎,我找到了完美的解决方案。打开输出窗口并构建解决方案。您将看到警告。将此警告添加到 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.

一抹淡然 2025-01-15 13:01:34

您无法抑制来自特定 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.

Project Properties, Build Page

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文