Sonarscanner End does not generate correctly the sonar-project.properties file for multiple projects

SonarQube - Community Edition - Version 10.5
dotnet-sonarscanner (version 6.2.0)
C# - MAUI Project
.NET8

Hi SonarSource team,

I am working on how to use sonar-scanner for c# in MAUI projects.

The analysis works correctly on the MAUI project, but the solution includes two other projects that are not being analysed.

I have detected that the problem is that the End command does not generate the sonar-project.properties file correctly.

My solution has 3 projects, “ProjectName”, “ProjectName.Domain” and “ProjectName.Data”, and only the properties “sonar.cs.analyzer.projectOutPaths” and “sonar.cs.roslyn.reportFilePaths” are generated for the project “ProjectName”.

These are the commands that are executed:

dotnet sonarscanner begin /k: "ProjectName" /d:sonar.host.url="http://localhost:9000" /d:sonar.token="sqp_..." /d:sonar.verbose=true
dotnet build --no-incremental ProjectName.sln -c Debug
dotnet sonarscanner end /d:sonar.token="sqp_..."

And this is the sonar-project.properties file that was generated:

sonar.projectKey=ProjectName

sonar.working.directory=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/.sonarqube/out/.sonar

sonar.projectBaseDir=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/ProjectName

sonar.pullrequest.cache.basepath=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui

AC177356-6F33-44DE-B44C-A476894D90CC.sonar.projectKey=ProjectName:AC177356-6F33-44DE-B44C-A476894D90CC

AC177356-6F33-44DE-B44C-A476894D90CC.sonar.projectName=ProjectName.Domain

AC177356-6F33-44DE-B44C-A476894D90CC.sonar.projectBaseDir=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/ProjectName/ProjectName.Domain

AC177356-6F33-44DE-B44C-A476894D90CC.sonar.sourceEncoding=utf-8

AC177356-6F33-44DE-B44C-A476894D90CC.sonar.sources=\

“/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/ProjectName/ProjectName.Domain/AppBuilderExtensions.cs”,\

AC177356-6F33-44DE-B44C-A476894D90CC.sonar.working.directory=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/.sonarqube/out/.sonar/mod0

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.projectKey=ProjectName:1535B4F9-734A-4EDF-862C-22936E1F9888

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.projectName=ProjectName

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.projectBaseDir=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/ProjectName/ProjectName

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.sourceEncoding=utf-8

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.sources=\

“/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/ProjectName/ProjectName/Platforms/Android/Resources/values/colors.xml”,\

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.cs.analyzer.projectOutPaths=\

“/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/.sonarqube/out/6”

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.cs.roslyn.reportFilePaths=\

“/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/.sonarqube/out/6/Issues.json”

1535B4F9-734A-4EDF-862C-22936E1F9888.sonar.working.directory=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/.sonarqube/out/.sonar/mod1

A976A2DD-F82F-4DEA-8ECA-EE682382F508.sonar.projectKey=ProjectName:A976A2DD-F82F-4DEA-8ECA-EE682382F508

A976A2DD-F82F-4DEA-8ECA-EE682382F508.sonar.projectName=ProjectName.Data

A976A2DD-F82F-4DEA-8ECA-EE682382F508.sonar.projectBaseDir=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/ProjectName/ProjectName.Data

A976A2DD-F82F-4DEA-8ECA-EE682382F508.sonar.sourceEncoding=utf-8

A976A2DD-F82F-4DEA-8ECA-EE682382F508.sonar.sources=\

“/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/ProjectName/ProjectName.Data/API/Requests/BillingAddressRequest.cs”,\

A976A2DD-F82F-4DEA-8ECA-EE682382F508.sonar.working.directory=/Users/myname/Documents/Dev/ProjectName/ProjectNameMaui/.sonarqube/out/.sonar/mod2

sonar.visualstudio.enable=false

sonar.modules=AC177356-6F33-44DE-B44C-A476894D90CC,1535B4F9-734A-4EDF-862C-22936E1F9888,A976A2DD-F82F-4DEA-8ECA-EE682382F508

Any possible workaround for this?

Thank you in advance!

Hey there.

This smells similar to Problem scanning .NET 8 targeted projects on MacOS - #26 by antonio.aversa

Are you using the latest version of .NET 8, and not a pre-release version, for example?

Hi,

I’m using a release version…

dotnet --version
8.0.300

dotnet sonarscanner --version
SonarScanner for MSBuild 6.2

Hi,

I have detected the problem. If the target framework is specified, it works correctly.

dotnet build --no-incremental ProjectName.sln -c Debug -f:net8.0-android

I’m sorry this thread completely fell off my radar. Thanks for following-up.

Hello @rolivares,

I am glad you were able to find a workaround for your issue.

However, you should be able to run an analysis without having to specify the target framework when running the dotnet build command.

Would you be able to provide a small reproducer for this issue?
I am not familiar with MAUI projects, so it would help a lot if you could do it. :pray:

Thank you,

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