SonarLint Issues - VS2015

In my project, we have visual studio 2015, where were have installed sonar lint plug-in.
We had a ruleset defined which we added to all the projects in the solution.
Also we did a baseline activity of supressing the existing issues in Global suppression file.
Now can integrate the sonar lint code analysis with the local build so that if there are any issues, local build fails and developers has to implement the code review findings.
But when integrate the sonar lint by changing the properties “Enable Code analysis on build”, the build takes a lot of time and most of the times VS hangs.
Also when we did a baseline activity, VS studio used to hang and so lot of existing issues could not be suppressed.
Also can we take out a report where any new code review findings which are due to new changes.

Please help

In Visual Studio 2015, “Enable Code Analysis on Build” only applies to the legacy FxCop code analysis rules. It does not cause Roslyn-based analysers like SonarC# to be run.

The only way that the SonarC# analysis rules would be executed on build in VS2015 would be if you had added the NuGet package to each of your projects.

Try uninstalling SonarLint and re-executing your baseline/build step. Is the result the same?

How can we integrate sonar lint rules with local build or with CI/CD? Can you provide some details on that?

Just to be clear, I am suggesting that your problems with analysis in VS with “Enable Code analysis on build” set are probably due to the legacy FxCop engine, not SonarLint.

If SonarLint is installed VS will automatically run the analysis live in the IDE and display the results in the Error List. You don’t need to configure anything to make this happen.

If you want the analysis rules to be run when building locally using MSBuild, you would need to reference the SonarC#/SonarVB NuGet packages in your projects.

CI integration is covered in the documentation e.g. scanners for different build systems, PR decoration, and CI integration.

Hi Duncanp,

That really helped…Can you also provide details if we want to integrate code analysis with the TFS build with just sonar lint and not using sonar qube

Hi @Vishal_Chheda. If you want issues to be analysed in CI builds but don’t want to use SonarQube/SonarCloud, then you would have to configure your projects to use the SonarC#/SonarVB NuGet packages.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.