SonarCloud tasks in Azure DevOps build pipeline do not work with C# projects behind the corporate proxy

Hello @mickaelcaro and the others

Since this is a real problem for us, I spent couple of days trying to find some workaround at least and this is what I found.

The SonarCloudPrepare task in our build machine already has two versions: 1.7.0 and 1.9.0. So it updates automatically. Looking into detailed logs, ´1.9.0´ is used in pipeline (and it is not working). I tried to run it manually, not by running the task itself, but running

dotnet <path to SonarScanner.MSBuild.dll> begin ...
... build step is in between ...
dotnet <path to SonarScanner.MSBuild.dll> end

as documented here. Is obviously still did not work.

So I downloaded Sonar Scanner for MSBuild, and built it myself. Copied the netcoreapp3.0 build to the build machine. I had also to:

  • Copy there SonarScanner.MSBuild.Tasks.dll which is build in the one of the projects in that repository.
  • Download latest sonar-scanner, so I used version 4.2.0.1873 and also copied it to the dotnet-sonar-scanner-msbuild folder.

This works. :tada:

But is is just a proof of concept that the latest version works. Because using it this way, it lacks most of the functionality. Right now, we are analyzing just master branch, when it is updated.

  • I can not run Pull Request analysis.
  • I can not run SonarCloudPublish task, so the result is not visible directly in the build.

Although probably I would manage to make these work. It seems they need correct settings (some environment variables) before the run. But it would be a lot of additional work to investigating what/how to set up.

So what I would like, is you to publish the latest version of your SonarCloud tasks for Azure Pipelines as soon as possible. I hope they will work.

And please let us know here when you will publish them. Because for now, we will stick to this manual master branch analysis. So we want to know when the new tasks are available, to try them.

Thanks a lot, Stano

1 Like