Sonar begin fails because of missing .net core framework

sonar begin fails on our build server (Bitbucket pipelines) with the following error:

Server running version (
begin /"" /k:"XXX" /o:"XXX" /n:"XXX" /d:sonar.exclusions="**/DbMigrator/**,**/Scripts/*.sql" /v:"0.1.0-alpha.40" /d:sonar.cs.vstest.reportsPaths="**/TestResults-*.xml" /d:sonar.coverage.exclusions="**/TestUtils/**,**/DbMigrator/**,**/*.sql" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.login="[REDACTED]"
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
  - The following frameworks were found:
      5.0.7 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:

The build is running on a unix (debian) container with the following .NET Core SDK/runtime installed:

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.301/
Host (useful for support):
  Version: 5.0.7
  Commit:  556582d964
.NET SDKs installed:
  5.0.301 [/usr/share/dotnet/sdk]
.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Why does sonar begin require .NET Core 2.0.0?

Hi @farmadthomasdc , welcome to the community.

How are you pulling the Scanner for .NET within your pipeline ?


We’re using Cake which in turn uses NuGet Gallery | dotnet-sonarscanner 5.2.2

However, I found this related issue on github:
The workaround mentioned on that page solves the issue. I had to add a new environment variable DOTNET_ROLL_FORWARD with value Major

Ok, glad it works then ! Because in this nuget we embed the .NET 5 version as well, so you might be able to use it.

Ok, interesting. How can I force the use of the .NET 5 version?

It’s done automatically depending on the version of the .NET CLI you use to run the Scanner.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.