Not able to scan C# file using sonar scanner msbuild

while running the analyzer on our c# projects they aren’t analyzing the files correctly and getting below warning
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

we are using jenkins to run sonarscanner below is the command

d:
cd %WORKSPACE%
sonar-scanner.bat -D"sonar.organization=orgname" -D"sonar.projectKey=projectname" -D"sonar.sources=." -D"sonar.host.url=https://sonarcloud.io" -D"sonar.login=tokenid"
SonarScanner.MSBuild.exe begin /k:"projectname" /d:sonar.login="tokenid"
MSBuild.exe .\Source\applicationname.sln /t:Rebuild
SonarScanner.MSBuild.exe end /d:sonar.login="tokenid"

we tried with two different version of sonnarscanner but still no luck
sonar-scanner-msbuild-5.3.1.36242-net46
sonar-scanner-msbuild-5.3.1.36242-net5.0

Hi @dpadhya - welcome to the community!

If you are only analysing C# or VB.NET code then you don’t need the following line:

Also, you will need to include the sonar.organization and sonar.host.url arguments in the call to SonarScanner.MSBuild.exe begin.

Thanks @duncanp for quick reply, above error got fixed after making those changes but now i am getting below error, do you have any idea about this ?

Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
21:47:54.153  SonarQube analysis could not be completed because the analysis configuration file could not be found: D:\Jenkins\workspace\ProjetName_CITest\.sonarqube\conf\SonarQubeAnalysisConfig.xml.
21:47:54.154  Post-processing failed. Exit code: 1

Apologies for the delay. If you haven’t managed to solve this, please provide the verbose logs of the BEGIN an END steps and I’ll take a look.

To create the verbose logs, pass /d:sonar.verbose=true to the SonarScanner.MSBuild.exe begin step.