Error SonarScanner C# and VB.NET

Greetings, I searched a lot before opening this topic and unfortunately I didn’t find a solution.

I recently installed Sonarqube Community on an AWS instance

I downloaded the SonarScanner through this link, tested the .Net 5.0 packages and also the .Net 4.6, made the reference in environment variables and then ran the solution in Visual Studio, and then did the scan as directed by Sonarqube.

I used the following commands:


"SonarScanner.MSBuild.exe begin /k: "aed2" /d:sonar.host.url="http://ip-server-sonarqube" /d:sonar.login="token""


MsBuild.exe /t:Rebuild


SonarScanner.MSBuild.exe end /d:sonar.login="token"

It is understood that the words token and ip-server-sonarqube have been replaced because they are sensitive information.

This is the error I get when I finish the scanning steps:

INFO: ------------- Run sensors on project
INFO: C# sensor [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 https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html
INFO: C# sensor [csharp] (done) | time=0ms
INFO: VB.NET sensor [vbnet] (done)
WARN: Your project contains VB.NET 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 https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html
INFO: VB.NET sensor [vbnet] (done) | time=0ms

I also tested with jenkins and get the same error with both, can you help me?

Hi,

Welcome to the community!

That’s the error you get when you’re not using the SonarScanner for .NET, which your command list indicates you are using. The only thing that catches my eye in your command is the space between /k: and the key string. But I wouldn’t expect it to have that result.

Could you provide the full analysis log, starting from the analysis command?

 
Ann

Hello, thank you for the greetings.

I think the space was added wrongly, I will leave a screenshot of the project analysis

I would like to send you another piece of the log by private message, is that possible ?
I believe this is more sensitive information.

Hi,

Feel free to redact your analysis log as needed.

 
Ann

1 Like

Ann, I would also like to point out that I tried to run the scanner with jenkins, but also without success, I noticed only one variation: when I run it through jenkins it evaluates the whole project, both front end and back end.
When I run it locally in visual studio, it only scans the backend folders.
When I try to run it locally in another directory, it asks to run it in the solution’s directory.
I look forward to your help, thank you!

Hi,

Thanks for the log. As far as I can tell, you’re doing everything right. So I’ve referred this for more expert attention.

 
Ann

1 Like

Ok, thank you very much, is there anything I can do?
Or some other way to scan the code?
I would like to inform you that my project is made in NetFramework 4.6