. NET CORE Mvc application is failing to scan

Hi Team,

I’m using Bitbucket yml file to build the .Net core project. But the build is failing due to ‘Task MSBuild execution failed’

It is actually looking for MSBuild.exe file along with the solution file during the build. As I’m performing the operation in Linux, I’m using Xbuild module with the build.

Template of Yml file in bitbucket:

Image: Microsoft/dotnet:latest

  • Pipelines:…
    Apt-get update
    Export path __
    Apt-get install mono-xbuild openjdk-8-8jre nuget
    Mono_IOMP=Case /t:build /p:configuration =“Release” Solution.sln

How can I mention the MSBuild.exe with the solution file when I’m executing the above script through bitbucket. Also how can I install MicrosoftSDK framework and mention the. Exe file in the yml file?

Thank you

Hey Sudhir,

I don’t actually see anything related to SonarCloud here. :confused: If you take analyzing with SonarCloud out of the mix, do you still have problems? Are you using an example from somewhere?


1 Like

Hi @Sudhir

If you run a build on linux and want to analyze with the Scanner for MSBuild, you’d better look at the dotnet CLI along with this community thread that explains how it should be configured.

Let us know !



1 Like

Hi Mickael,

Thanx for the quick response.

I’ve actually followed the same example which you have posted in the comments (Bitbucket pipe+ Sonarcloud +. Net core)

But the build is failing with the following error:

Task “MSBUILD” execution - - FAILED
Warnings : /opt/atlasssian/agent /build/B. Sln warning : opt/atlasssian/agent /build/A/A.csproj : DATA at the root level is invalid. Line 1 position 1
opt/atlasssian/agent /build/B.sln warning: Don’t know how to handle globalsection extensibility globals, ignoring.

opt/atlasssian/agent /build/B.sln (Build) - >
/usr/lib/mono/xbuild/14.0/bin/microsoft.csharp.targets (core compile target)

3 warnings
1 error

Time elapsed 00.00.05.

Could you please let me know what’s wrong with the file.

Can you check that you don’t have any BOM on your csproj’s files ?

By the way, the Scanner for MSBuild hasn’t been tested with XBuild, so we cannot guarantee that it will work out of the box with it.

Hi @mickaelcaro,

The build is actually not failing when its running in the local host.

When I’ve tried to scan the project using the Bitbucket-pipelines.yml file as per the example, just to analysis the code coverage, I’m getting the error which I’ve mentioned above.

Thank you

And did you manage to make it work on bitbucket pipeline, but without any Sonar analysis plugged in ?