Hi,
I am trying to analyze test project using SonarAnalyzer.CSharp in Visual Studio. I added SonarAnalyzer.CSharp 8.51.0.59060 package to project and customized ruleset. Rule S1481 and S2221 should return errors when violated.
Error for S1481 is detected correctly, but error for rule S2221 is not visible is Error Tab in Visual Studio after build.
I assume that reference to Microsoft.VisualStudio.TestPlatform.TestFramework or other test related packages in my test project cause SonarAnalyzer to skip certain rules. After removing TestFramework reference I can see errors for both rules S1481 and S2221 in Error Tab in Visual Studio after build.
Based on documentation I was trying to add the following parameter
<PropertyGroup>
<SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>
to .csproj file but it does not help in that case. However, it allowed to analyze test project during PR and all violated rules are visible in SonarCloud.
Is there any way to force SonarAnalyzer.CSharp to analyze and list all violated rules in test project in Visual Studio?