Csharp files of subprojects are not scanned by SonarQube

Hi Pavel, I tried to send you the log files through a prviate mail, but this mail was rejected. See below:
(i removed the unique code from the emailadres for this post)

We’re sorry, but your email message to [“ sscommunity+…@discoursemail.com ”] (titled RE: [SonarSource Community] [PM] Private log share) didn’t work.

Do you use more than one email address? Did you reply from a different email address? Email replies require that you use the same email address when replying. Alternately, the Message-ID header in the email may have been modified.

I’m not sure how it works when you send an email. Just open this website and reply to that private thread with an attachment.

I’ve published my reproducer project:

Only difference should be that I’ve tried to move the SLN file to the /Src/SmazatWithShared/. Other than that, it should have same structure as yours.

But in general:

  • I have this git repository.
  • Root of the repository contains Shared and src/SmazatWithShared projects
  • SmazatWithShared.csproj contains <Import Project="..\..\Shared\Shared.projitems" Label="Shared" />
  • I have default VSTS build step “Build solution ***.sln”.
    Type: Visual Studio Build
    Description: Build with MSBuild and set the Visual Studio version property

So the build definition should start in root of the repository. Also the scanner command (run by the Prepare Analysis Configuration step) should be startedin the root. Scanner should be able to see the Shared and src without any special configuration. Build will find SLN file itself and build it.

There must be some difference in the setup I’ve tried to reproduce.

Hi Pavel,

The only difference i see, is the location of the solution. In our environment the solution file resides in the main folder SmazatWithShared-master. In your example the solution file is in the SmazatWithShared-master\Src\SmazatWithShared folder.

Otherwise i donnot see any other differences. I have moved the solution to the root folder, but this also works fine.

The devil is in the details! But where is the detail?

and a snapshot of our TopoCAD program

As you can see no lines of code in our shared folders.

That excludes the sonar.projectBaseDir from the equation I think. We should start looking somewhere else.

Please try to share the full logs in the private conversation. There might be a clue.

No Lines of Code might come from a fact that the projects are considered to be a test code (not a production code). Can you verify this settings on your side? And if it’s implicit, can you try to set it explicitly to production code?
Try adding this to your .shproj file

  <PropertyGroup>
    <SonarQubeTestProject>False</SonarQubeTestProject>
  </PropertyGroup>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.