Missing to detect .NET language in sonar cloud

Template for a good new topic, formatted with Markdown:

  • ALM used Azure DevOps
  • CI system: Azure DevOps
  • Languages of the repository: Net Core 3.1.8 , C#, Json , Yaml

Hi everyone,

Our organization uses sonar cloud paid plan for static code analysis. We setup sonar integration using Azure Devops for REST API project but I don’t see the language showed in the project after creation. Can someone help me out with this? Is there any configuration which needs to be setup in sonar cloud for projects to detect the language which is being used and show in the sonar UI.

It is just showing me yaml not the .net language which was used to build the project

NOTE: This is the same case/problem with all the projects which we have with other languages (i.e for android/web/etc). Also I am not using any exclude properties here but it skipped all the source code lines here

Thank you,

Hey there.

How exactly are you performing analysis? Can you share your Azure DevOps Pipeline YAML?

WIS_WebApp_RestAPI-CI-PR.zip (786 Bytes)
Hey Colin,

Please find Azure DevOps Pipeline YAML file.

This analysis is done in Azure DevOps during every PR check. We enabled sonar as one of the build validations during PR merge.

Thank you!

  scannerMode: CLI
  configMode: manual
  cliProjectKey: WebApp-RestAPI
  projectKey: WebApp-RestAPI
  cliProjectName: WIS_WebApp_RestAPI

You should make sure you’re using the Scanner for .NET, following the documentation here or in the tutorial available in the SonarCloud UI when creating a project (or visiting the project-level Administration > Analysis Method)

WIS_WebApp_RestAPI-CI.zip (783 Bytes)

Attached latest log I have tried to use cmd to install dotnet-sonarscanner.

We used the same manual config mode for other languages like web/android. The projects are able to detect languages after creation only for .net we are unable to get that.

Is there any example available with standalone scanner/manual for .net? Else please guide me what needs to be added in Azure DevOps pipeline as a task.


You must use the Scanner for .NET, ticking the Integrate with MSBuild option.

Hey @Colin

I have tried even with Integrate with MSBuild option its not working. I have created a test project where it states the project is empty. Here the main branch is dev I renamed and ran but no luck.

NOTE: We are using standalone scanner/manual option for all the repos and every other repo is working fine and able to detect the language except .net which is stated in above scenario.

With manual/standalone scanner it worked earlier but not sure why it is not working now. Is there any working example available for standalone scanner?

Attached build logs for more info:
logs_16150.zip (240.6 KB)

I noticed it skipped whole source code



Can anyone look into the above issue pls?

Thank You!

Hey there.

The standalone scanner cannot be used to scan .NET code, as the error message has outlined.

What happened when you tried? Can you share the logs from this attempt?

Build configuration:
WIS_WebApp_RestAPI-CI-PR.zip (734 Bytes)

Build Logs:
logs_16403.zip (246.1 KB)

Sonar Analysis:

Scanner mode: Integrate with msbuild (Tried with the other scanner mode as suggested above)
branch: dev (dev is our main/master branch here so renamed the branch as dev in sonar ui at project level and did analysis)

FYI we used standalone scanner mode in past for .net projects and it worked as expected.

I also found a similar opened ticket which is taking only yml files: Sonar is not scaning all the folders in project - #5 by durga_prasad_boddu

Once try

  • task : VSBuild@1
    Solution: ‘***.sln’

May be it will work

Tried that way but the error is still same. the project analysis is empty and its not taking any source code