If I build with pipeline build A (using SLN A) all the csproj projects I would expect to see appear
If I build with pipeline build B (using SLN B), the extra csproj projects I would expect to see do not appear
in the pipelines build for B I can see the below parts so its finding the code etc
SonarCategoriseProject:
Sonar: (CISIWeb2.csproj) Categorizing project as test or product code…
Unable to parse assembly name ‘@()’
Sonar: (CISIWeb2.csproj) categorized as MAIN project (production code).
SonarCreateProjectSpecificDirs:
Creating directory “D:\a\1.sonarqube\conf\19”.
SonarWriteFilesToAnalyze:
Sonar: (CISIWeb2.csproj) Number of files to analyse: 1724. The list of files to be analyzed is in D:\a\1.sonarqube\conf\19\FilesToAnalyze.txt.
SetRoslynCodeAnalysisProperties:
Sonar: (CISIWeb2.csproj) Analysis configured successfully with D:\a\1.sonarqube\conf\19\SonarProjectConfig.xml.
SonarQubeImportBeforeInfo:
Sonar: (CISIWeb2) SonarQube.Integration.ImportBefore.targets was loaded
It’s written at the top of the prepare or analyze log basically.
So what are those extra csproj in SLN B that do not appear ? Are they classic projects with product code ?
You can check which projects/files have been indexed by issuing a build using the system.debug=true build variable. Then on the Analyze task logs, you’ll have a dump of the sonar-project.properties that has been generated, containing everything that will be analyzed just after.
Task : Prepare Analysis Configuration
Description : Prepare SonarCloud analysis configuration
Version : 1.21.0
Author : sonarsource
Help : Version: 1.21.0. More Information
OK I have 2 Azure Devops Pipelines - cisi and cisiweb2…
The cisiweb2 pipelines builds the cisiweb2.sln which includes cisiweb2 project (cisiweb2.csproj) and related projects each in a folder with the same name eg /cisiweb2
The cisi pipeline builds the cisi.sln which builds various projects
Some shared projects such as cisi.shared.csproj are in both sln files so would be built by both pipelines
csproj projects are a mix of old style and new style sdk (eg .net standard 2.0 and .net core projects)
for the purposes of this all projects are c# based csproj
All the files including the 2 sln files are in the same GIT repository on Azure Devops
I already had a cisiweb2 pipeline build with the debug options so can see the paths in the sonar-project .properties dump:
example line in cisiweb2 pipeline build:
“D:\a\1\s\CISIWeb2\Mvc\Models\ElearningAttemptDetails.cs”,\
The cisiweb2 build does not include the cpd project and as expected I don’t see anything from cpd folder in the dump
As far as I can see each pipeline build is overwriting what was placed in sonarqube by the previous one so I need a way of stopping this
currently the cisiweb2 pipeline is the most recent to complete and in sonarcloud I can see all its projects
when the cisi pipeline (currently building) finishes, then many of the above projects will disappear from sonarcloud and be replaced by the projects from the cisi pipeline
I need it so the 2 aren’t fighting and all the projects from both pipelines are showing up
Either create a separate SonarCloud project for both pipeline
Or try to have everything built in the same sln : the reason why is that we don’t currently support partial analyses, meaning that if you do :
SC Prepare
Build SLN1
SC Analyze
SC Prepare
Build SLN2
SC analyze
both targetting the same SonarCloud project, then you fall into what you whitnessed ie the latest project to send its report will overwrite everything.
OK I think I got it sorted by using the Monorepo setup and then setting each pipeline SonarCloudPrepare@1 to have a different projectKey and projectName