No analysable projects were found - Azure DevOps/Self hosted agent

scanner
sonarqube

(Senthilnathan Ramadoss) #1

I created a Azure DevOps Build pipeline for a .NET Core solution and tried to configure the SonarQube in the build but endup with errors. I followed the steps from the link - https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Extension+for+VSTS-TFS

WARNING: File ‘C:***\DocumentDBRepository.CS’ is not located under the root directory ‘C:\VSTSAgent_work\1\s’ and will not be analyzed.
No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.

In the Prepare analysis on SonarQube task - I choose the “Integrate with MSBuild” option.

The path it was referring to execute was the c:\VSTSTask_work\1\s. But the sourcecode was in a different location - C:\MaaS

So I added the Advanced -> additional properties section, I added the below

sonar.exclusions=/*.bin
sonar.cs.vscoveragexml.reportsPaths=
/*.coveragexml
sonar.projectBaseDir=C:\maas

After adding the changes I see the same error.

Later, I also choose the Use standalone scanner and choose - “Store configuration with my source code” and included the sonar-project.properties file in the root location of the solution.
I used the link - https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild

15:18:22.955 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.ProjectLock
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:64)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:265)
at org.sonar.scanner.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:118)

I also tried “manually provide configuration” option, but I end up with the same error.

Version details

Azure DevOps
SonarQube - Onpremises v 6.7.1
Self hosted agent - Windows 2016
dotnet-sonarscanner v 4.5.0

sonar-project.properties

sonar.exclusions=/*.bin
sonar.cs.vscoveragexml.reportsPaths=
/.coveragexml
sonar.projectBaseDir=C:/maas/
**.MaaS
sonar.projectKey=maas
sonar.sources=.

12.txt (53.9 KB)
123.txt (305.0 KB)