# Sonar not analyze C# code

**URL:** <https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987>\
**Category:** SonarQube Server / Community Build\
**Tags:** csharp, dotnet, sonarqube\
**Created:** [September 5, 2022, 2:35pm UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987 "2022-09-05T14:35:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![berkant](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@berkant](https://community.sonarsource.com/u/berkant)\
**Post date:** [September 5, 2022, 2:35pm UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987/1 "2022-09-05T14:35:22Z")

</div>

Hi,  
We are using Sonarqube developer edition 8.9.7, sonar-scanner-msbuild-5.7.2.50892-net46, TargetFrameworkVersion = v4.6.2, Toolversion = 14.0. When we try to analyze C# code, Sonarqube found .cs file and indexed into FilesToAnalyze.txt. It showed our .cs codes on project onto web gui. I assume our configuration is fine but it cannot anaylze .cs code. In addition, project has approximately 200k lines of code. Report include ~150 code smell 0 bug 0 vulnerability. All code smells related with .xml files.  
Is there any idea why is happening or is there anybody encountered like this case.

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/d/ed1a34c02d2f4c699ce1066201371bee7ad9966d.png)

Thanks in advance  
Berkant

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [September 5, 2022, 2:40pm UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987/2 "2022-09-05T14:40:15Z")

</div>

Hey there.

This sounds like an issue of detecting test vs. product projects. Take a look at this documentation. [Analysis of product projects vs. test projects · SonarSource/sonar-scanner-msbuild Wiki · GitHub](https://github.com/SonarSource/sonar-scanner-msbuild/wiki/Analysis-of-product-projects-vs.-test-projects)

---

<div class="post-metadata">

**Author:** ![Mehmet\_Inan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mehmet_inan/32/30284_2.png) [@Mehmet\_Inan](https://community.sonarsource.com/u/Mehmet_Inan)\
**Post date:** [September 8, 2022, 1:08pm UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987/3 "2022-09-08T13:08:08Z")

</div>

Hi @Colin,

How are you? Could you please give us a spesific answer? Already we have a lot of documents on the internet. We read all. But we couldnt resolve the issue…cs files are not analysed. As you see below screenshot, cs files LOCs are not counted.

 ![linesOfCode](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/3/4/34b5769c4557669ca68177f43f93f338fc3f4971.png)

Thank you for your support,  
Kind regards,

---

<div class="post-metadata">

**Author:** ![duncanp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/duncanp/32/293_2.png) [@duncanp](https://community.sonarsource.com/u/duncanp)\
**Post date:** [September 8, 2022, 9:04pm UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987/4 "2022-09-08T21:04:28Z")

</div>

Hi @Mehmet_Inan,

The most likely explanation is that your projects are being treated as test code rather than product code. The page @Colin referred you to explains how to check this, specifically [this](https://github.com/SonarSource/sonar-scanner-msbuild/wiki/Analysis-of-product-projects-vs.-test-projects#understanding-why-a-project-was-categorised-in-a-particular-way) section.

Are your projects being correctly categorised?

---

<div class="post-metadata">

**Author:** ![Mehmet\_Inan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mehmet_inan/32/30284_2.png) [@Mehmet\_Inan](https://community.sonarsource.com/u/Mehmet_Inan)\
**Post date:** [September 13, 2022, 12:38pm UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987/5 "2022-09-13T12:38:27Z")

</div>

Hi Duncan,

We categorised but still same problem. But when you have a free time we can have a quick meeting.

Thank you,

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [September 14, 2022, 8:51am UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987/6 "2022-09-14T08:51:52Z")

</div>

Hey there.

This community doesn’t offer that kind of support.

Can you share the logs showing the projects are correctly categorized?

---

<div class="post-metadata">

**Author:** ![hergan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/hergan/32/52036_2.png) [@hergan](https://community.sonarsource.com/u/hergan)\
**Post date:** [November 27, 2023, 8:20pm UTC](https://community.sonarsource.com/t/sonar-not-analyze-c-code/70987/7 "2023-11-27T20:20:38Z")

</div>

Hi Mehmet, did you solve the problem? How many days have I been stuck at the same point?
