SonarLint editing csproj files even with Directory.Build.Props file present

Hello we are using Visual Studio 2022 and SonarQube with Developer edition We are trying to use SonarLint connected edition and after looking at community posts in this forums as well as using the following sample as guide:

We have also checked in this Directory.Build.Props and the .sonarlint folder into GitHub but everytime I open Visual Studio SonarLint output windows says that there are unbound project and then goes ahead to edit csproj files with following entry:

It doesnt create local rulesets for every project which it was doing before having the Directory.Build.props file so I know the props file is working but not sure if I missed some settings or configuration to avoid the SonarLint.xml entry in all the csproj files. Please find the Directory.Build.Props content below:


    <AdditionalFiles Include="$(MSBuildThisFileDirectory).sonarlint\*****\CSharp\SonarLint.xml">

I have removed the folder name which contains the sonarlint.xml file.
I have tried with and without Itemgroup entry present in the props file, I don’t get any different result. Also my solution file, Directory.Build.Props file and .sonarlint folder are in same folder.

Thanks for any help if possible.


You’re trying to set up connected mode by adding a file to your project/solution? Can you remove the file and try setting it up via the UI instead?


Hello, no I do the connection using UI only:

If I remove the Directory.Build.Props, SonarLint starts creating local rulesets for all projects as well the mentioned xml entries.

1 Like

@sk2312 did you manage to get this working?

You should be able to see an entry for the SonarLint.xml file in the Solution Explorer
e.g. image

If VS can’t find the file it will still appear in the Solution Explorer, but with a cross against it e.g.

In that case, either the file doesn’t exist, or there’s something wrong with the path in the props file.