“抑制警告” Visual Studio 2010 中的 menuitem 不可用

发布于 2024-09-16 16:14:17 字数 390 浏览 1 评论 0原文

我正在使用Visual Studio 2010 Ultimate,似乎我无法像在VS2008中使用的方式抑制警告。

我的项目是用 C# 编写的,当我右键单击“错误列表”窗口中的警告(例如,缺少公共类型的 XML 注释)时,我没有常用的菜单项来抑制此警告(代码中也没有)也不在全​​局抑制文件中)。

该项目的代码分析属性是“

在构建时启用代码分析”(定义 CODE_ANALYSIS 常量)=>未检查 抑制生成代码的结果=>检查

在代码分析的解决方案属性中,我将所有配置和所有平台设置为使用“Microsoft 所有规则”规则集。

有什么想法为什么我不再获得菜单项吗?非常感谢任何帮助,

提前致谢&

最好的问候,

G.

I'm using Visual Studio 2010 Ultimate, and it seems that I cannot suppress warnings in the way I used in VS2008.

My project is in C#, and when I right click a warning in the "Error List" window (e.g. for a missing XML-comment of a public type), I do not have the usual menu item to suppress this warning (neither in code nor in the global suppressions file).

The project's properties for Code Analysis are

Enable Code Analysis on Build (defines CODE_ANALYSIS constant) => not checked
Suppress results from generated code => checked

In the solution's properties for Code Analysis I set all configurations and all platforms to use the "Microsoft All Rules" rule set.

Any ideas why I don't get the menu item anymore? Any help is greatly appreciated,

thanks in advance &

Best regards,

G.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

塔塔猫 2024-09-23 16:14:17

我一直在努力解决这个问题,不知怎的,它似乎又开始工作了。问题是我无法准确地重现解决方案是什么,但无论如何,这是我尝试过的: - 工具>定制>命令>上下文菜单>单击“全部重置” - 检查“上下文菜单”>“ “其他上下文菜单 | 错误列表”中存在“抑制消息”的预期条目,否则添加它。

您还必须记住的是,您只能抑制 FxCop 生成的消息,因此无法抑制源和 XML 注释中不匹配的参数。

I've been trying to get this thing fixed, and somehow it seems to be working again. The problem is that I cannot exactly reproduce what the solution was, but anyway, here is what I tried: - Tools > Customize > Commands > Context menu > Click "Reset All" - Check that under Context menu > "Other Context Menus | Error List" the expected entry for "Suppress message(s)" exists, otherwise add it.

What you also have to keep in mind is that you can only suppress messages generated by FxCop, so a mismatching parameter in source and XML comment cannot be suppressed.

临走之时 2024-09-23 16:14:17

我也有同样的问题。对我来说,“错误列表”包含“运行代码分析”消息和“构建项目/解决方案”消息似乎有点令人困惑。仅当显式运行代码分析时才会出现该菜单。列表中的消息也略有不同,具体取决于来源。如果“抑制”选项应出现在上下文菜单中,则消息必须以“CAxxxx ...”开头

I had the same problem. To me it seem to be a little confusing that the "Error list" contains both "Run Code Analysis"-messages and "build projet/solution"-messages. The menu can only appear if the code analysis is run explicitly. The messages in the list are also a little bit different depending there origination. If the "suppress" option should appear in the context menu, the message must start with "CAxxxx ..."

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