有谁知道查看 VB.NET 项目的所有编译器警告的方法吗?
VB.NET 有一个相当烦人的限制,它将报告的编译器警告上限限制为 100。
vbc : warning BC42206: Maximum number of warnings has been exceeded.
当尝试评估遵守 VB.NET 最佳实践(例如启用 Option Strict)所需的工作量时,这会让人相当沮丧。
有什么方法可以消除、调整此限制,或者可以通过其他方式(例如通过第三方代码分析工具)收集警告?
VB.NET has this rather annoying limitation which caps compiler warnings reported at 100.
vbc : warning BC42206: Maximum number of warnings has been exceeded.
This makes things rather frustrating when trying to size up the amount of effort that would be required to comply with VB.NET best practices, such as enabling Option Strict.
Is there any way where this limitation could either be removed, adjusted, or could warnings be gathered by some other means (such as through a 3rd party code-analysis tool)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
官方的答案显然是“不”。来自 Microsoft:“虽然此问题确实存在,但 Visual Basic编译器团队决定对报告的错误保留硬性限制,因为这有助于提高性能。”
The official answer is apparently "No." From Microsoft: "While this issue does exist, the Visual Basic Compiler Team has decided to leave the hard limit to the reported errors because it helps with performance."
从 VB11 开始,在 VS2012 中,从命令行调用时,
vbc
不再具有最大错误限制。现在可能有一个更好的链接,但是 这个 会一直执行,直到我找到一个。
更新: 新链接
As of VB11, in VS2012,
vbc
no longer has a maximum error limit when called from the command line.There's probably a better link for this now, but this will do until I find one.
UPDATE: new link
您应该阅读在 Visual Basic 中配置警告以及如何:启用或禁用编译器警告
例如,您可以在编译器选项(在项目构建属性下)中使用以下行
(我自己没有尝试过...)禁用 100 个错误限制。
另一方面,100 个警告是一个非常大的数字。您可能应该检查您的代码,检查并修复这些警告的原因。
You should read Configuring Warnings in Visual Basic and How to: Enable or Disable Compiler Warnings
For example, you can to the compiler options (under the project build properties) the following line
this should (I haven't tried it myself...) disable your 100 errors limit.
On another note, 100 warnings is a very large number. You should probably go over your code, check and fix the reasons to those warnings.
我在从事的 SQL 项目中也遇到过同样的问题;限制为 200 条警告。然后当我修复它们时,新的会合并进来,所以数量永远不会减少!
我发现,如果您查看“输出”选项卡中的“构建”输出,您可以看到所有内容。就我而言,我有数千个。只需选择全部并将其复制/粘贴到文本编辑器中即可。
I've had the same problem with SQL projects I've been working on; the limit is 200 warnings. Then as I fix them, new ones merge in so the number never goes down!
I found that if you look in the "Build" output in the "Output" tab you can see everything. In my case I have thousands. Just select all and copy/paste it into a text editor.