# Sonar properties are not used by Azure Devops

**URL:** <https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921>\
**Category:** SonarQube Server / Community Build\
**Tags:** azure, azuredevops-services, sonarqube\
**Created:** [January 17, 2020, 1:46pm UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921 "2020-01-17T13:46:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristian.mo](https://avatars.discourse-cdn.com/v4/letter/k/c5a1d2/32.png) [@kristian.mo](https://community.sonarsource.com/u/kristian.mo)\
**Post date:** [January 17, 2020, 1:46pm UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921/1 "2020-01-17T13:46:41Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)  
Azure SonarQubePrepare/Plugin 4.8.0  
SonarQube Community Edition Version 8.0 (build 29455)

- what are you trying to achieve  
Hello, I am trying to get dotcover code coverage and nunit tests to be part of the sonarqube analysis on an azure devops pipeline.

- what have you tried so far to achieve this  
I have run tests and code coverage using a powershell script.  
The cobertura converted dotCover results are stored in cobertuta/coverage.xml relative to rootfolder.  
Nunit files are generated as \*nunit.dll.xml in different folders.

I tried adding properties to the task in azure

```auto
 - task: SonarQubePrepare@4
    inputs:
      SonarQube: ' ****'
      scannerMode: 'MSBuild'
      projectKey: '***'
      projectName: '***'
      extraProperties: |
        sonar.exclusions=**/*.xml
        sonar.cobertura.reportPath=cobertura/coverage.xml
        sonar.cs.nunit.reportsPaths=**/*nunit.dll.xml

```

I also tried adding a sonar-project.properties file in the root folder of the repository

```auto
sonar.exclusions=**/*.xml
sonar.cobertura.reportPath=cobertura/coverage.xml
sonar.cs.nunit.reportsPaths=**/*nunit.dll.xml

```

And I tried setting the same values on the sonarqube server in the project. Tried all at the same time and one by one. But when I run the task it always says no unit tests found and no code coverage found. I also tried adding the cobertura report to the temp directory on the agent but same issue.

```auto
2020-01-17T09:52:28.4956920Z ##[section]Starting: SonarQubeAnalyze
2020-01-17T09:52:28.5163227Z ==============================================================================
2020-01-17T09:52:28.5163313Z Task : Run Code Analysis
2020-01-17T09:52:28.5163356Z Description : Run scanner and upload the results to the SonarQube server.
2020-01-17T09:52:28.5163403Z Version : 4.8.0
2020-01-17T09:52:28.5163439Z Author : sonarsource
2020-01-17T09:52:28.5163492Z Help : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2020-01-17T09:52:28.5163848Z ==============================================================================
2020-01-17T09:52:29.1371027Z [command]E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
2020-01-17T09:52:30.1034460Z SonarScanner for MSBuild 4.7.1
2020-01-17T09:52:30.1035600Z Using the .NET Framework version of the Scanner for MSBuild
2020-01-17T09:52:30.1414338Z Post-processing started.
2020-01-17T09:52:31.0973059Z 10:52:31.096 Fetching code coverage report information from TFS...
2020-01-17T09:52:31.0988253Z 10:52:31.098 Attempting to locate a test results (.trx) file...
2020-01-17T09:52:31.2757152Z 10:52:31.275 Looking for TRX files in: E:\agent\_work\21\TestResults
2020-01-17T09:52:31.2760808Z 10:52:31.275 No test results files found
2020-01-17T09:52:31.4606148Z 10:52:31.46 Did not find any binary coverage files in the expected location.
2020-01-17T09:52:31.4616521Z 10:52:31.461 Falling back on locating coverage files in the agent temp directory.
2020-01-17T09:52:31.4625976Z 10:52:31.462 Searching for coverage files in E:\agent\_work\_temp
2020-01-17T09:52:31.4635987Z 10:52:31.463 No coverage files found in the agent temp directory.
2020-01-17T09:52:33.9421742Z WARNING: File 'E:\agent\_work\21\s\XXXX' does not exist.
2020-01-17T09:52:34.1390048Z Calling the SonarQube Scanner...
2020-01-17T09:52:34.4608295Z INFO: Scanner configuration file: E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\sonar-scanner-4.1.0.1829\bin\..\conf\sonar-scanner.properties
2020-01-17T09:52:34.4654950Z INFO: Project root configuration file: E:\agent\_work\21\.sonarqube\out\sonar-project.properties
2020-01-17T09:52:34.6060756Z INFO: SonarQube Scanner 4.1.0.1829
2020-01-17T09:52:34.6061269Z INFO: Java 1.8.0_231 Oracle Corporation (64-bit)
2020-01-17T09:52:34.6061491Z INFO: Windows 10 10.0 amd64
2020-01-17T09:52:35.5222408Z INFO: User cache: C:\Users\admin\.sonar\cache
2020-01-17T09:52:36.2219211Z INFO: SonarQube server 8.0.0
2020-01-17T09:52:36.2233491Z INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
2020-01-17T09:52:36.5969186Z WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
2020-01-17T09:52:36.6935444Z INFO: Load global settings
2020-01-17T09:52:37.4791816Z INFO: Load global settings (done) | time=785ms

```

Any idea what I am missing?

Can I log the properties of the sonarqube run somehow?

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [January 17, 2020, 2:36pm UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921/2 "2020-01-17T14:36:31Z")

</div>

Hi @kristian.mo ,

I think that your are mixing somehow the possibilits of the different properties available for tests executions and coverage.

As per the [SonarQube doc](https://docs.sonarqube.org/8.0/analysis/coverage/) here are the supported property around C# projects :

For coverage :

`sonar.cs.vscoveragexml.reportsPaths`  
`sonar.cs.dotcover.reportsPaths`  
`sonar.cs.opencover.reportsPaths`

For unit test executions (will show the number of unit tests executed / discovered).

`sonar.cs.vstest.reportsPaths`  
`sonar.cs.nunit.reportsPaths`  
`sonar.cs.xunit.reportsPaths`

Any other provided will be ignored.

Mickaël

---

<div class="post-metadata">

**Author:** ![kristian.mo](https://avatars.discourse-cdn.com/v4/letter/k/c5a1d2/32.png) [@kristian.mo](https://community.sonarsource.com/u/kristian.mo)\
**Post date:** [January 21, 2020, 11:58am UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921/3 "2020-01-21T11:58:14Z")

</div>

Thank you for helping with the correct properties.

---

<div class="post-metadata">

**Author:** ![kristian.mo](https://avatars.discourse-cdn.com/v4/letter/k/c5a1d2/32.png) [@kristian.mo](https://community.sonarsource.com/u/kristian.mo)\
**Post date:** [January 21, 2020, 2:38pm UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921/4 "2020-01-21T14:38:42Z")

</div>

Got it working for nunit with this:

```auto
       inputs:
        SonarQube: '***'
        scannerMode: 'MSBuild'      
        projectKey: '*'
        projectName: '*'   
        extraProperties: |
          sonar.exclusions= **/*.java,** /*.jar, **/*.xml, 3rdPartyLibraries/** , UIAutomationTesting/**, 
packages/ **, CM/**
          sonar.cs.nunit.reportsPaths=$(Agent.BuildDirectory)/**/*nunit.dll.xml

```

Now the 1 million dollar question is what dotcover format is compatible with sonarqube?

XML or DetailedXML gives missing \<!DOCTYPE HTML error, HTML it cannot find.

---

<div class="post-metadata">

**Author:** ![kristian.mo](https://avatars.discourse-cdn.com/v4/letter/k/c5a1d2/32.png) [@kristian.mo](https://community.sonarsource.com/u/kristian.mo)\
**Post date:** [January 21, 2020, 3:49pm UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921/5 "2020-01-21T15:49:50Z")

</div>

For anybody else.

This devops task

```auto
  - task: SonarQubePrepare@4
    inputs:
      SonarQube: '**'
      scannerMode: 'MSBuild'      
      projectKey: '*'
      projectName: '*'   
      extraProperties: |
        sonar.exclusions= **/*.java,** /*.jar, **/*.xml, 3rdPartyLibraries/** , UIAutomationTesting/ **, packages/** , CM/**
        sonar.cs.dotcover.reportsPaths=$(Agent.BuildDirectory)/**/*coverage.html
        sonar.cs.nunit.reportsPaths=$(Agent.BuildDirectory)/**/*nunit.dll.xml

```

and this dotcover made it work

```auto
dotCover.exe analyse /targetexecutable=".\packages\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe" /targetarguments="UnitTest.dll --result=nunit.dll.xml --noheader" /output=coverage/coverage.html /reporttype=HTML

```

---

<div class="post-metadata">

**Author:** ![vowne](https://avatars.discourse-cdn.com/v4/letter/v/5fc32e/32.png) [@vowne](https://community.sonarsource.com/u/vowne)\
**Post date:** [June 14, 2021, 7:01pm UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921/6 "2021-06-14T19:01:34Z")

</div>

The SonarQube code analysis task in our build pipeline yaml getting failed with below error.

Not sure from where the sonarqube is taking the location from . its taking the users home directory now. /home/vowne. We have enough space in other location and would need to change the sonarqube temp location to there.

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar on project: Unable to load component interface org.sonar.api.utils.TempFolder: Failed to create temporary folder in /home/vowne/.sonar: /home/vowne/.sonar/.sonartmp\_xxxxxxx: No space left on device

---

<div class="post-metadata">

**Author:** ![vowne](https://avatars.discourse-cdn.com/v4/letter/v/5fc32e/32.png) [@vowne](https://community.sonarsource.com/u/vowne)\
**Post date:** [June 16, 2021, 1:25pm UTC](https://community.sonarsource.com/t/sonar-properties-are-not-used-by-azure-devops/18921/7 "2021-06-16T13:25:43Z")

</div>

@mickaelcaro @kristian.mo

Any suggestion on the above issue… can we set any additional property in the sonarqube pligin task part to change the temp directory creation from the /home/vowne to /data

```auto
- task: SonarQubePrepare@4
    inputs:
      SonarQube: 'Sonarqube'
      ScannerMode: 'Other'
      extraProperties: |
          sonar.projectName=${{ parameters.myName }}
          sonar.coverage.jacoco.xmlReportPaths=$(System.DefaultWorkingDirectory)/coverage-report/target/site/jacoco-aggregate/jacoco.xml
          sonar.userHome=$(System.DefaultWorkingDirectory)

```
