Sonarlint dotnetcore2多个目标框架给出了重复的警告(Sonarlint dotnetcore2 multiple targetframeworks gives duplicate

编程入门 行业动态 更新时间:2024-10-28 19:28:39
Sonarlint dotnetcore2多个目标框架给出了重复的警告(Sonarlint dotnetcore2 multiple targetframeworks gives duplicate warnings)

我使用SonarLint作为dotnetcore 2项目,该项目也针对net461。 每个目标框架都会报告每个警告,导致重复的警告。

我试图通过向分析器软件包ref添加一个条件来解决这个问题,但这不起作用:

<PackageReference Include="SonarAnalyzer.CSharp" Version="6.7.1.4347" Condition="'$(TargetFramework)'=='netcoreapp2.0'"> <PrivateAssets>all</PrivateAssets> </PackageReference>

有没有什么方法可以为1个目标框架设置sonarlint?

例:

I'm using SonarLint for a dotnetcore 2 project, this project also target net461. Each warning gets reported for each targetframework, resulting in duplicate warnings.

I tried to fix this by adding a condition to the analyzer package ref, this didn't work:

<PackageReference Include="SonarAnalyzer.CSharp" Version="6.7.1.4347" Condition="'$(TargetFramework)'=='netcoreapp2.0'"> <PrivateAssets>all</PrivateAssets> </PackageReference>

Is there any way to setup sonarlint for 1 targetframework only?

Example:

最满意答案

这看起来确实有点奇怪,但这是基于roslyn的分析仪的默认行为。 从我的测试来看,这个行为与StyleCope.Analyzers , Roslynator , CodeCracker等产生的行为是一致的。

我还没有在Roslyn存储库上找到任何有关此行为更改的故障单。

This looks indeed a bit weird but this is the default behavior of roslyn-based analyzers. From my tests the behavior is conform with the one produced by StyleCope.Analyzers, Roslynator, CodeCracker and so on.

I haven't found any ticket on Roslyn repository regarding a change of this behavior.

更多推荐

本文发布于:2023-08-07 02:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1458285.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:出了   多个   框架   目标   Sonarlint

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!