To disable auto-analyze for SonarCloud with a .NET project, can we add a sonar file similar to Java?

We’re using:

  • Github with CircleCI to run analysis for SonarCloud.
  • Currently using SonarScanner for MSBuild 5.12

We’re trying to understand how - from the repository itself - can we disable automatic analysis that is on-by-default in sonarcloud with a .NET project. For Java projects we can just have a sonar-project.properties file in the base directory of the repository. Is there a similar method for the MSBuild scanner to disable automatic analysis?

The information at Automatic Analysis | SonarCloud Docs doesn’t seem to match up with SonarScanner for .NET | SonarCloud Docs to disable automatic analysis. When we add the file and try to analyze, we get error:

SonarScanner for MSBuild 5.12
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
03:50:44.998  sonar-project.properties files are not understood by the SonarScanner for MSBuild. Remove those files from the following folders: /root/project
03:50:44.998  Post-processing failed. Exit code: 1

Exited with code exit status 1

CircleCI received exit code 1

I’m guessing that perhaps having a SonarQube.Analysis.xml file like

<SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">

  <Property Name="sonar.host.url">https://sonarcloud.io</Property>

</SonarQubeAnalysisProperties>

Might help, but not sure.

Hey there.

Sorry, this got lost (our default view of topics we should look at include topics with no replies… when somebody replies to their own post it’s less visible).

I’ve flagged this for attention because I know it came up after Automatic Analysis for .NET was released.

Hello @Rick-at-KUBRA

In order to turn OFF the Automatic Analysis you need to do the following:
Go to the project tab → Administration → Analysis Method, and at the top you will find a toggle to enable/disable Automatic Analysis.

Also if there is a sonar-project.properties file in your repo root, the Automatic Analysis will be set to OFF when you add the project to SonarCloud.

1 Like

Hey @Rick-at-KUBRA

We recently launched SonarCloud Enterprise, which includes support for organizaiton-wide config like disabling Automatic Analysis for new projects.