Sonar Cloud Analysis c# support

Hello,

There is sonar cloud analysis integrated into my project but It does not analyze c# code.
What is missing in the setup?

Also, want to disable the HTML analysis, is it possible?

Hey there.

Can you share how your analysis is configured? If you’re integrating with a specific CI (Azure DevOps Pipelines, for example), can you share your azure-piplines.yml file?

Hi,

One note, if you are on Github and using Automatic Analysis, there is a chance SonarCloud cannot pick up the .NET code if your repository is not yet indexed by Github.
You can check that by running a search on your repository, in the top right search bar (for example enter path:.csproj)
If you are taken to a page that says “your repository is being indexed” then that is your problem.
In that case, run the same query until you get results, and then disable/enable automatic analysis in SonarCloud (from the Administration/Analysis Method menu, uncheck and recheck the “automatic analysis” option)

Hi!!
We are using Circle/CI for the analysis and here is the sample

version: 2.1

orbs:
  sonarcloud: sonarsource/sonarcloud@2.0.0
  node: circleci/node@5.1.0
  ruby: circleci/ruby@2.0.1

jobs:
  sonar:
    docker:
      - image: cimg/base:stable
      - image: 'node:16.14.0'
    resource_class: medium
    steps:
      - checkout
      - node/install
      - sonarcloud/scan

workflows:
  main:
    jobs:
      - sonar:
          context: SonarCloud

You won’t be able to use sonarcloud/scan, as that only executes the SonarScanner CLI, not the SonarScanner for .NET which is required (along with a full build) to analyze C# code.

Do you currently have a CircleCI build that builds your .NET code?

No, we dont have a CircleCI build that builds the .NET code.

Then you won’t be able to have CircleCI analyze your C# code.

If your code is hosted on GitHub, I would take another look at what @denis.troller mentioned. In this case, your code could be analysed via Automatic Analysis, no build required.

The code is hosted on bitbucket

Hi, after a quick check it appears you are using an orb that uses the “default scanner”.
Some languages (C++, Maven, Gradle, .NET) require a specific scanner for technical reasons.

In your case, you need to find an orb that uses the Scanner for .NET, for example CircleCI Developer Hub - bestsellerit/sonarcloud-dotnet
Using this you might be able to run the analysis in your CircleCI pipeline.