Latest version of SonarCloud DevOps tasks (current do not work behind corporate proxy)

Hello

@mickaelcaro

SonarCloud extension 1.10.0 did not help. The behavior is still exactly the same as I describe in this post.

The problem is not in the task itself, but in the sonar scanner DLLs it contains. I tried my own DLLs and it works.

Working concept

In our pipeline, we use MSBuild scanner mode:

- task: SonarCloudPrepare@1
  inputs:
    SonarCloud: 'SonarCloud'
    organization: 'krossk'
    scannerMode: 'MSBuild'
    projectKey: 'esw.invoicing.test'

And this is not working - it is not able to connect to the https://sonarcloud.io because of the proxy.

I cloned MSBuild scanner and built the latest version (commit 10eeb6638833bf74d61869841ac706c79eb10f26). I did not do anything special, just opened SonarScanner.MSBuild.sln in Visual Studio 2019 and built it in release configuration - that’s all.

At the build agent, the SonarCloudPrepare task is located in _work\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.10.0 folder. And the MSBuild (classic) scanner is located in classic-sonar-scanner-msbuild subfolder. So in this folder, I replaced the files with mine, built in previous step. I used netcoreapp3.0 release build.

  • Newtonsoft.Json.dll
  • SonarScanner.MSBuild.exe
  • SonarScanner.MSBuild.Common.dll
  • SonarScanner.MSBuild.PostProcessor.dll
  • SonarScanner.MSBuild.PreProcessor.dll
  • SonarScanner.MSBuild.Shim.dll
  • SonarScanner.MSBuild.TFS.dll
  • SonarScanner.MSBuild.TFS.Classic.dll

Furthermore, I had to copy there two more files, which was not in original task, but was in my build output folder, and the task did not work without them.

  • SonarScanner.MSBuild.dll
  • SonarScanner.MSBuild.runtimeconfig.json

At last, I had to restart the agent service, because it had some of the DLLs already loaded.

Now the SonarCloud works as expected.

So my conclusion is, that SonarCloud task has some different libraries and exe file. Can someone investigate this and maybe create a new version of the task, with the latest build of the scanner for netcoreapp3.0?

Thank you, Stano

Just note: CLI mode is not working even if I replace all the DLL-s. But CLI mode does not raise errors anyway, it just does not scan .cs files (just .sql and .html files in our project).