Xamarin Solution with Dependency Projects

I do apologize if this question was asked, but I’ve been unable to find a scenario that matches. My project is a Visual Studio 2019 for Mac (Xamarin.iOS) project that includes references to its dependencies which are contained in separate projects in subdirectories of the main project.

When I run an analysis (via Jenkins) using SonarQube 8.0 and SonarScanner for MSBuild 4.8 - .Net Framework 4.6 (running on MacOS High Sierra), I get results in SonarQube for the Application project platform-specific and platform-independent code, but the Dependency projects are ignored, despite the fact that they are included in the solution and compiled in the MSBuild step.

MainProject.sln is the application. FieldServices, Velsol.Core, Velsol.Core.Data, and Velsol.Core.Mobile are dependencies. As I said, I get results in SonarQube for MainProject, but none of the dependencies.

Any guidance you can provide is appreciated. If I can provide further info, please let me know.


Additional information about the project configuration:

Note that FieldServices, Velsol.Core, Velsol.Core.Data, and Velsol.Core.Mobile all have their own csproj files and are capable of being standalone projects that we typically would compile into nuget packages for inclusion in other projects.

Hello @rbanker,

First, welcome to our community forum :slight_smile:

Our C# analyzer is based on roslyn, and as such, the analysis step will take place during the build of the project.
If possible, could you share how your solution (.sln) is built exactly ?
Basically, if the dependency projects are not part of the build but included as nuget or dll dependencies in your main project, then they cannot be analyzed at the same time, since the analysis will only take place on the source code at build time.
If this is the case, when are these dependecies built ? Because that would be the place where you can integrate with the SonarQube analysis.

If not, could you please share (either here or by private message) the verbose logs of the analysis on Jenkins ? That would definitely help.


Hi Chris,

Sorry for the slow response. During this particular compilation, we are not using the nuget packages to fulfill the dependencies – the nuget projects are simply compiled with the primary project and included as references of the project. I would think this would allow them to be analyzed. The compile log is attached. The projects that would normally be compiled as nuget packages will be ******.Core, ******.Core.Data, and ******.Core.Mobile.

Thanks for your help.

Roblog.txt (2.9 MB)

Hi @rbanker,

Is that log file from the Jenkins build agent, or is it from a build triggered from inside Visual Studio?
It looks from the log that it was from a build in which BuildingInsideVisualStudio is true:

Target "SonarQubeImportBeforeInfo" skipped, due to false condition; ( $(SonarQubeTempPath) != '' AND $(BuildingInsideVisualStudio) != 'true' ) was evaluated as (  != '' AND true != 'true' ).

This particular build was triggered inside Visual Studio, but the result is the same regardless of whether or not I trigger it from Visual Studio of Jenkins.


@rbanker the final outcome might be the same but the intermediate steps won’t be.

The VS logs shows that our main targets Sonar.Integration.targets file is never loaded, which is expected when building in VS.

The build agent logs will tell us whether the main targets file is loaded, and should give us some clues as to why all of the analysis targets are not being executed as expected.