Search code examples
sonarqubesonarqube-msbuild-runner

The build is configured to run SonarQube analysis but the SonarQube analysis targets could not be located


I am new to .Net and new to SonarScanner with MS Build. I am looking forward for your help on resolving the error I get when I build the project after sonarscanner-msbuild begin process .

C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets(62,5): error : The build is configured to run SonarQube analysis but the SonarQube analysis targets could not be located. Project: XYZ.csproj [E:\jenkins\workspace\XYZ\XYZ.csproj]

Solution

  • Tips and clues:

    1. Ensure you have run SonarScanner.MsBuild begin before executing MsBuild
    2. Run MsBuild with /v:diagnostic switch to get detailed troubleshooting log. In the log lookup SonarQubeTargetsPath and SonarQubeTargetFilePath values.
    3. In case of this or another configuration difficulty see my tutorial on how to setup SonarQube in .NET ecosystem: https://blog.pragmasoft.pl/software/2018-10-10-sonarqube-2-setup-environment/