I am trying to scan a .net Solution which contains multiple projects.
I have build the pipeline as per the documentation but it is not scanning the codes.
Here is the pipeline Agent config:
below you can find the YAML version:
after the scanning is finished, I cant see the line of codes, bugs, code smells etc.
Please let me know what wrong I am doing here.
Please help get it solved.
You need to specify
- task: SonarQubePrepare@5
Thanks for your quick reply. I did add the scannerMode but still I have the same issue.
Please find the actual YAML code below: and suggest what else I should change.
name: Azure Pipelines
- task: SonarQubePrepare@5
displayName: 'Prepare analysis on SonarQube'
SonarQube: 'SonarQube ArpG AG'
- task: NuGetToolInstaller@1
displayName: 'Use NuGet '
- task: NuGetCommand@2
displayName: 'NuGet restore'
- task: MSBuild@1
displayName: 'Build solution ArpG.ContactReport.sln'
- task: SonarQubeAnalyze@5
displayName: 'Run Code Analysis'
- task: SonarQubePublish@5
displayName: 'Publish Quality Gate Result'
Anything interesting in the analysis logs (files indexed, analysis warnings/errors)?
Same result as before (screenshot given in the main problem description)
No Coverage or Line of Code
I’m referring to the analysis logs (the logs from your Azure DevOps Pipeline), where the SonarQubeAnalyze task is run.
All the steps were executed successfully?
I’ll appreciate your help if you please have a look at the logs and let me know where I did wrong. or If I have missed any step.
here I have attached log of Build Solution and Run Code Analysis. if you need any other log I am at your disposal. please let me know I’ll share with no time.
DevOps Pipeline Run Log.txt (84.3 KB)
DevOps Pipeline Log for Run Code Analysis.txt (34.2 KB)
Take a look at this warning message:
2022-05-30T17:42:00.9247165Z WARN: SonarScanner for .NET detected only TEST files and no MAIN files for C# in the current solution. Only TEST-code related results will be imported to your SonarQube/SonarCloud project. Many of our rules (e.g. vulnerabilities) are raised only on MAIN-code. Read more about how the SonarScanner for .NET detects test projects: Analysis of product projects vs. test projects · SonarSource/sonar-scanner-msbuild Wiki · GitHub
Thanks this comment already helped.
and the adding of one extra property group in the project solved the whole issue.
I am surprised why it is not documented or why no one else stuck in this problem before
<!-- Project is not a test project -->
Thanks for the link and the problem seems to be solved now.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.