C# and .Net Scanner: No analysable projects were found. SonarQube analysis will not be performed

  • SonarQube version: 6.7
  • SonarScanner: sonar-scanner-msbuild-4.6.2.2108-net46

In a C# project using sonar-scanner-msbuild-4.6.2.2108-net46 we get the following error

We start the scan

d:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master>"d:\jenkins\tools\ci-home\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScanner_for_MSBuild_4.6\SonarQube.Scanner.MSBuild.exe" begin /k:"im.server" /n:"IM Server" /v:"fa4ed9a0667735935ac1897a9b339d53b8b3b9d7"  /d:sonar.host.url=https://sonar.intra
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
------------------------------------------------------------------------
SonarScanner for MSBuild 4.6.2Using the .NET Framework version of the Scanner for MSBuildPre-processing started.Preparing working directories...
09:54:38.945  Updating build integration targets...
09:54:38.967  Fetching analysis configuration settings...
09:54:40.363  Provisioning analyzer assemblies for cs...
09:54:40.364  Installing required Roslyn analyzers...
09:54:40.572  Provisioning analyzer assemblies for vbnet...
09:54:40.572  Installing required Roslyn analyzers...
09:54:40.612  Pre-processing succeeded.
....

build the application successfully and then run the end scan

d:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master>"d:\jenkins\tools\ci-home\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScanner_for_MSBuild_4.6\SonarQube.Scanner.MSBuild.exe" end 
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
------------------------------------------------------------------------
SonarScanner for MSBuild 4.6.2Using the .NET Framework version of the Scanner for MSBuildPost-processing started.
WARNING: Duplicate ProjectGuid: "ecdb88bb-63d3-479a-90bb-f2cb140bd744". The project will not be analyzed by SonarQube. Project file: "d:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master\SC.IM.Common\SC.IM.Common.csproj"
...
WARNING: File 'd:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master\SC.IM.WebService\Code\ServiceBase.cs' is not located under the root directory 'd:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master\.sonarqube\out' and will not be analyzed
....
No analysable projects were found. SonarQube analysis will not be performed. 
Check the build summary report for details.Generation of the sonar-properties file failed. 
Unable to complete SonarQube analysis.
09:56:55.084  Post-processing failed. Exit code: 1

Two days ago I’ve also got an inital scan working, but since then, I never got it working again. Also not deleting the project in SonarServer and do it all over again.

Hello Adrian,

How is your solution configured ? Do you actually have serveral projects with the same GUID ? (from the warning in the log: WARNING: Duplicate ProjectGuid: "ecdb88bb-63d3-479a-90bb-f2cb140bd744". The project will not be analyzed by SonarQube. Project file: "d:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master\SC.IM.Common\SC.IM.Common.csproj" )

Could you please also share with us the full log of the build, as well as these 2 files: .sonarqube\out\ProjectInfo.log and .sonarqube\conf\SonarQubeAnalysisConfig.xml (relative to the root folder where the analysis/build takes place). That would greatly help us to find where your issue might come from.

Thanks.
Regards,

-Chris

I already had a look in meanwhile with support. So finally we came to the conclution that the issue is cause it took the wrong base directory

Using fallback project base directory: 'd:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master\SC.IM.WebService\Code\ServiceBase.cs' is not located under the root directory 'd:\jenkins\tools\ci-home\workspace\und_im-ci-pipeline-server_master\.sonarqube\out'

So by explicitly setting sonar.projectBaseDir solved the problem. Concretely I aggregate the following parameter to the call within the Jenkins pipeline

"/d:sonar.projectBaseDir=\"${pwd()}\""

A post was split to a new topic: No analysable project were found