SonarQube is not reading a single C# file

SonarQube has been used as a quality code check in our TeamCity DevOps build pipeline. This is implemented in production environment. The build is based on Dynamics CRM solution comprises of code including C#, JavaScript and XML based files.
SonarQube is reading code written in JavaScript files but completely ignored code saved in C# files. It is not reading a single C# file. As this is happening in our production environment so urgent help is required.

Thanks

Hi,

Welcome to the community!

At a guess, you’re not using the SonarScanner for .NET, are you? If you were, I think you’d be complaining that your C# files are analyzed but not your JS &etc.

For you, the trick to getting everything in one go is to is to start with the SonarScanner for .NET, and then make sure a project references all the other files. I’ve had success before with syntax like this in a .csproj file:

<ItemGroup>
  <Content Include="src\**\*.js"/>

 
HTH,
Ann

Thanks for the response, Ann.
Actually, we tried with the Sonar Scanner and Runner both but nothing is working. It is reading the JS and other files but skipping the C# files in TeamCity pipeline.

So, if you can suggest me or share the link, how .cs files can be scanned through SonarQube/Scanner/Runner, will be highly appreciated.

Regards,
Om

Hi Om,

It’s not clear to me what distinction you’re making there. You should be analyzing C# code with the SonarScanner for .NET. Unfortunately, I don’t have details on the mechanics of that for TeamCity.

 
Ann

Hi,

We are using the Sonar Runner in TeamCity to check the code quality and any vulnerability in our D365 CRM project, which usage C#, Java, JS languages. Sonar runner can read the Java and JS files in pipeline but skipping the C# files. Please check the log below:

Thanks,
Om

Hi Om,

Your log clearly shows you’re using the SonarScanner when you should be using the SonarScanner for .NET if you want to analyze C# code.

I don’t know what more I can say.

 
Ann