Sensor C# Not Picking Up Some .cs Files

Sonarqube: 9.4
Azure DevOps Extension: 5.8.0
dotnet-sonarscanner: 5.8.0 (global)

We’re running into the error below. I have seen other posts regarding this mentioning:
scannerMode: “MSBuild” - cliProjectKey being renamed to projectKey - we tried different iterations and combinations… we updated the extension and scanner… MSBuild of course doesn’t work on dotnet (SDK) projects. We have UTF-8 set for the encodings. We’re at a loss…

We did see some unicode characters in some commented areas. Will these commented unicode characters mess with the scan even though encodings are set?

INFO: ------------- Run sensors on project
INFO: Sensor C# [csharp]
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 | SonarQube Docs
INFO: Sensor C# [csharp] (done) | time=0ms

@kirkpabk,

The SonarQube and SonarCloud Azure DevOps extension have a copy of the SonarScanner for .NET embedded in them, so you don’t need to install the scanner separately.

If you are analysing a .NET project on Azure DevOps, you have two choices:

Option 1: use the SonarQube Azure DevOps extension

In that case, your yaml should like the following, as per the SonarQube docs:

steps:
# Prepare Analysis Configuration task
- task: SonarQubePrepare@5
  inputs:
    SonarQube: 'YourSonarqubeServerEndpoint'
    scannerMode: 'MSBuild'
    projectKey: 'YourProjectKey'

# steps to build the solution / projects ...

# Run Code Analysis task
- task: SonarQubeAnalyze@5

# Publish Quality Gate Result task
# (this step is optional)
- task: SonarQubePublish@5
  inputs:
    pollingTimeoutSec: '300''

Option 2 - install and use the SonarScanner for .Net
In this case, you would install and call the SonarScanner for .NET directly yourself using one of the approaches described in the scanner docs.

Miscellaneous

That’s not correct. The dotnet command line tooling is actually a thin wrapper around MSBuild.