有没有办法为CSPROJ中的开放API分析仪配置警告级别

发布于 2025-02-09 20:08:47 字数 603 浏览 1 评论 0原文

遇到了一个问题,团队正在使用< treatwarningsaserrors> true</treatwarningsaserrors>在项目中,并在不同机器上获取不同的错误列表。挖掘并确定这是编译器版本不同的问题(4.0 vs 4.2)。使用分析级别&模式设置试图指示编译器针对特定版本的警告方案,但仍然有一些与开放API分析仪有关的差异。
< include openapianalyzers> true</includepenapianalyzers>

特别是,具有4.2编译器的机器正在报告API1000& amp; API1003与4.0编译器完全没有显示在机器上。是否有配置标志可以应用于此分析仪以尝试获取所有机器报告相同的错误列表?我宁愿说服4.0机器报告错误,而不是告诉4.2机器抑制它们。

附带说明,该组织的公司安全姿势意味着将所有人更新到同一编译器版本将是一个重要的PITA,可能需要数周的时间。希望有一种方法可以通过项目配置到达那里。


编辑: 我播放了更多,发现4.0机器上的Visual Studio确实将警告视为警告,当我打开该文件时的警告,但是编译器在执行构建时并不将其视为警告或错误。

Running into an issue where the team is using <TreatWarningsAsErrors>true</TreatWarningsAsErrors> in the projects and getting a different list of errors on different machines. Have dug in and determined it is an issue with compiler versions being different (4.0 vs 4.2). Have used the analysis level & mode settings to try to instruct the compilers to target a certain version of the warning scheme, but still have a few discrepancies related to the Open API Analyzers.
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>

Specifically, the machines with 4.2 compiler are reporting errors for API1000 & API1003 that are not showing up at all on the machines with the 4.0 compiler. Is there a configuration flag I can apply to this analyzer to try to get all the machines reporting the same list of errors? I would prefer to convince the 4.0 machines to report the errors rather than tell the 4.2 machines to suppress them.

Side note, Corporate security posture in this organization means getting everyone updated to the same compiler version will be a significant PITA and could take weeks. Hoping there is a way to get there through project configurations.


EDIT:
I played a bit more and found that visual studio on the 4.0 machine does detect the warning as a warning when I have the file in question open, but the compiler does not see it as either a warning or an error when executing the build.

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

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

发布评论

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

评论(1

野生奥特曼 2025-02-16 20:08:47

我没有因以下两个设置而违反api1002的警告或错误。

<TreatWarningsAsErrors>true</TreatWarningsAsErrors
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>

如果我添加此设置,我会这样做。

<WarningsAsErrors>API1002</WarningsAsErrors>

因此,解决方法可能涉及将您感兴趣的规则添加到warningsaserrors属性中。

I am not getting warnings or errors for violations of API1002 with the following two settings.

<TreatWarningsAsErrors>true</TreatWarningsAsErrors
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>

I do if I add this setting.

<WarningsAsErrors>API1002</WarningsAsErrors>

So a workaround could involve explicitly adding the rules that you are interested in to the WarningsAsErrors property.

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