Setting Sariff version in Errorlog property leads to no analysis results

I am currently experiencing the following warning:

“WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see SonarScanner for .NET

This warning appears whenever I set any SARIF version in the ErrorLog property of my C# project file Directory.Build.props, for example:

<ErrorLog>$(MSBuildProjectDirectory)\example.txt;version=2</ErrorLog>

This results in no analysis being performed. However, if I omit the version, like this:

<ErrorLog>$(MSBuildProjectDirectory)\example.txt</ErrorLog>

everything works fine. The issue is that the default version is 1, but I want to use version 2.

Any ideas on how to resolve this? I have already checked for issues related to the ErrorLog property and found some concerning relative paths, but nothing about setting the SARIF version.

My Setup (same issue occurs in an Azure pipeline on a Linux agent):

  • SonarScanner for MSBuild 6.2
  • Using the .NET Core version of the Scanner for MSBuild
  • Configuration File: 5.0.1.3006/conf/sonar-scanner.properties
  • SonarScanner Version: 5.0.1.3006
  • Java Version: 21.0.2 Homebrew (64-bit)
  • Operating System: Mac OS X 14.5 aarch64

I just even found a stale open issue (Handle /errorlog:[file][,version] parameter correctly · Issue #1176 · SonarSource/sonar-scanner-msbuild · GitHub) for the error. So this issue seems to be known. Any ideas how to proceed now?

Hello David Schmittwilken

As mentioned by you, there is an open ticket about supporting V2.1 of the Sarif file format:

Let’s continue the discussion there and keep it in a single place.