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.