The problem is that we want to do an analysis only on the contents of Folder2 which is a module for our application (that’s why we provide that path using the sonar.projectBaseDir) but somehow no matter what we tried so far the analysis takes place also inside Folder1 which is the folder of the application itself.
I’ll start by saying that I find C# analysis a bit tricky. And I see two options here
override sonar.sources on the command line to point to just Folder2. I’m less optimistic about this one since a big part of what the SonarScanner for .NET does is define sonar.sources from the build environment.
drop sonar.exclusions and use sonar.inclusions=$(Build.SourcesDirectory)\Folder1\Folder2 I think this has a better chance of working since it builds on the sonar.sources definition crafted by the scanner. And when you do this, you can drop sonar.projectBaseDir as well.
You’ll need to tune your analysis with inclusions or exclusions. The exact details will depend on your project structure. I’d advise you to play around with it until you get to settings that accomplish your goal. Do not use inclusions and exclusions together. That way lies madness.