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

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Languages of the repository: C#

Hello

I would like to know when will be released latest versions of SonarCloud tasks for Azure DevOps pipelines. The current version 1.9.0 does not work behind corporate proxy.

I did some investigation and it seems that the latest one works. I already wrote (at the end of december) it in an older topic where the whole issue is described: SonarCloud tasks in Azure DevOps build pipeline do not work with C# projects behind the corporate proxy

I did not want to start a new topic, but a month has passed and there is no reply in that one.

Thank you, Stano

Hi,

Version 1.10.0 of the SonarCloud extension for Azure DevOps is available, you should give it a try.

Mickaël

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).

Hi,

For the time being, if you want to use the dotnet version of the DLLs (.net core i mean), you should build your solution on Linux (that’s kind of a limitation on our side, we will work on improving this).

Mickaël

Hi

I have created an DevOps build task UseNetCoreSonarCloud@1, which simply replaces SonarCloudPrepare task’s DLLs with .NET Core ones. Its the automatic solution I described in my previous comment. It works only for MSBuild scanner of SonarCloudPrepare.