SonarLint Generated Files, Visual Studio 2022, and .gitignore

Hello,

I have SonarLint in Visual Studio 2022 connected to a local SonarQube instance for the first time, and as a part of that connection SonarLint adds a SonarLint.xml and SOLUTIONNAME.slconfig to the solution, as well as new .ruleset files and csproj updates to include those rulesets to each project in the solution. We are using Git in Azure DevOps for our source control. In this context, should any of the SonarLint autogenerated files be gitignored or should they all be checked in and tracked?

Thanks!

-Thomas

2 Likes

Hi @tparikka - welcome to the community.

In general, I would suggest committing them. They won’t have any effect unless SonarLint is installed on the developer’s machine.

If you don’t commit the files generated files but do commit the project-level changes then you might get warnings from MSBuild. It won’t affect the build, but the warnings create unnecessary noise.

FYI It is possible to make the VS binding less noisy/impactful e.g. by removing the project-level rulesets and using a Directory.Build.props instead (see here for more information).

1 Like

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