Using .NET core builds and MSBuilds with Sonar

scanner
sonarcloud

(Edwin Vriethoff) #1

Hi,
I currently have a team working on a .NET core project in combination with our SonarCloud subscription.

As you can see in the screenshot they have 2 msbuild tasks, but also 2 .net core builds in their build definition.
The .net core builds do not run any sonar analysis.
I already asked the team if they could use MSbuild instead of the .net core build. But they do not really prefer this.
What should be the supported scenario for this situation?


(Fabrice Bellingard) #2

Hi Edwin,

after talking to the team, it looks like this is not supported to trigger one single analysis for such a “multiple build” build definition. A solution in this case is to have dedicated build definitions for each .NET solution.


(Edwin Vriethoff) #3

Hi Fabrice,

We have managed to change the project to a single .net core build.
But now it seems there is no code analysis happening.

What should be the correct settings for the ‘Prepare analysis task’ for a .net core build? (o.a. which build agent to use? )


(Fabrice Bellingard) #4

When you create a build definition, our extension provides templates, including one for .NET Core projects. Did you take a look at this?


(Edwin Vriethoff) #5

Hi Fabrice,

Which extension do you mean? We use the SonarQube tasks as we cannot use the SonarCloud tasks in TFS.
The SonarQube prepare task gives us the option “Integrate MSBUILD”, “Maven or Gradle” and “Use Standalone scanner”. We do not see any option for .NET core.

Regards,

Edwin