gpt4 book ai didi

visual-studio - 抑制解决方案的警告

转载 作者:行者123 更新时间:2023-12-04 15:29:59 25 4
gpt4 key购买 nike

我似乎无法通过进入 来抑制 Visual Studio 2017 中解决方案中的警告。项目设置 > 构建 > 禁止警告 :

enter image description here

即使当我清理 - 构建,重建等......解决方案时,Visual Studio 也会不断为我提出这些警告。

我是通过 a visualstudio.com report 提出的昨天,现在它被“分类”了。是否有其他方法可以在不标记每个引用的情况下抑制解决方案中的警告?

版本:15.6.2

更新:
这很奇怪。
Visual Studio 2017 默认使用分号,但逗号有效。

最佳答案

我通常使用 pragma directives :

#pragma warning disable 1591 
// whatever member is lacking xml comments, or even the whole file
#pragma warning restore 1591

来自上面链接的逐字逐句:

disable: Do not issue the specified warning message(s).



如果您真的想在解决方案范围内禁用警告, there's no way to do it .

All compilation options are specified on the project level. MSBuild exists below the level of solutions.



但它可以在项目方面完成 ,就像你在上面做的那样;我唯一要改变的是使用逗号分隔这些代码,而不是像图片中的分号(最后没有逗号),例如:
1591,1701,1702,1705

那是因为编译器选项 use a comma .

关于visual-studio - 抑制解决方案的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49564022/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com