简体   繁体   中英

SonarQube with MsBuild: sonar.cs.analyzer.projectOutPaths no protobuf files will be loaded for this project

I am running the SonarQube 7.5 with Sonar Scanner MsBuild 4.5 and it works but no results is available on the project configured on the Sonar. Let me detail what I have done.

What I have done

I installed the SonarQube V7.5 Community and start it as a Windows Service. I download the MsBuild Scanner 4.5 and add this folder on the PATH of the Windows fallowing the documentation. After that, I create a new project and run the scripts on a Dummy Console Application. The scripts I have run over the console are:

Run the BEGIN step of the SonarQube

SonarScanner.MSBuild.exe begin 
              /k:"HappyAppKey" 
              /d:sonar.host.url="http://localhost:9000" 
              /d:sonar.login="f3965814e7fdcf4f32e26adc1e69d6f5f851cafc"

Run the MSBUILD to compile the project from the sln file

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe HappyApp.sln /t:Rebuild

Run the END step of the SonarQube to analysis and submit

SonarScanner.MSBuild.exe end 
           /d:sonar.login="f3965814e7fdcf4f32e26adc1e69d6f5f851cafc"

It works without errors and I can see the source code on the sonarQube but no bugs, smell code, duplications etc... are available to see on the SonarQube like the picture bellow

在此处输入图片说明

Analysing the generated log on the end step, I can see this warning message

15:24:48.807 WARN: Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.
15:24:48.808 WARN: No Roslyn issues report found for this project.

What am I doing wrong? Should I add something on the folder of the project? Any file to configure something? (It's my first time with SonarQube).

Thank you.

Solution: Install the right MsBuild version (which should be 14 or above for .Net Framework projects). Follow these steps:

  • Download and install the Build Tools for Visual Studio 2017 available on this link
  • Note that you now have the folder C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin .
  • Over the command prompt, navigate at the folder and perform a MsBuild -version and you should see the right version:
Microsoft(R) Build Engine versão 15.9.21+g9802d43bc3 para .NET Framework
Copyright (C) Microsoft Corporation. Todos os direitos reservados.

15.9.21.664
  • If you want, add the folder on the PATH of the Windows.
  • Build your project using this Msbuild.exe.
SonarScanner.MSBuild.exe begin /k:"MyProjectKey" /d:sonar.verbose=true /d:sonar.host.url="http://localhost:9000" /d:sonar.login="3c8d70d998f72178c7a21c1a83590d8af1f6e014"

MSBuild.exe "D:\temp\MyProject\Project.csproj" /t:Rebuild 

SonarScanner.MSBuild.exe end /d:sonar.login="3c8d70d998f72178c7a21c1a83590d8af1f6e014"

I have the same issue. But I use the right version of MSBuild.

d:\build\workspace\walls_Build_wb11452\WBServices>d:\build\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Scanner_for_MsBuild_4.6.2\SonarScanner.MSBuild.exe begin /k:project_name /n:project_name /v:"2" /d:sonar.language=cs /d:sonar.sourceEncoding=UTF-8 /d:sonar.host.url="url" /d:sonar.login="******" 
SonarScanner for MSBuild 4.6.2

d:\build\workspace\walls_Build_wb11452\WBServices>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" Solution.sln /t:Rebuild /m:2 /p:Configuration=Debug /p:DefineConstants="X64PROCESS;AUTO" 
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework

No idea...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM