我使用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.
更多推荐
发布评论