Sonarlint builds not all project inside solution

  • Operating system: Win 11
  • SonarLint plugin version:
  • Programming language you’re coding in: C#
  • Is connected mode used: yes
    • Connected to SonarCloud or SonarQube (and which version): SonarQube Developer Edition
  • Visual Studio version: Professional 2022 - 17.6.4

And a thorough description of the problem / question:
I’ve one solution in Visual Studio which holds multiple projects. This solution has been connected to SonarQube, including all projects inside. In two of the projects SonarLint is working as expected. When I type a variable that isn’t used, the IDE is telling me that this variable is not in use.

When I do the same in another project in the same solution, the IDE doesn’t show anything. The output window when I set the view to SonarLint:

[Suppressions] Fetching all suppressions...
[ConnectedMode/BranchMapping] Closest Sonar server branch: master
[ServerIssueStore] Raising change event...
[Suppressions] Finished fetching all suppressions
[SecretsAnalyzer] Analyzing D:\Projects\Microservices\ProjectName\Program.cs
Settings file does not exist at "D:\Projects\Microservices\.sonarlint\xxx-xxx_secrets_settings.json".
[RuleSettings] Unable to load/locate connected mode settings. Falling back on standalone mode settings.
[SecretsAnalyzer] Finished analyzing D:\Projects\Microservices\ProjectName\Program.cs, analysis time: 0,01s
[SecretsAnalyzer] Found 0 issue(s) for D:\Projects\Microservices\ProjectName\Program.cs

The logging on the working project:

[SecretsAnalyzer] Analyzing D:\Projects\Microservices\ProjectName2\Program.cs
Settings file does not exist at "D:\Projects\Microservices\.sonarlint\xxx-xxx_secrets_settings.json".
[RuleSettings] Unable to load/locate connected mode settings. Falling back on standalone mode settings.
[SecretsAnalyzer] Finished analyzing D:\Projects\Microservices\ExterneAPI\Program.cs, analysis time: 0,021s
[SecretsAnalyzer] Found 0 issue(s) for D:\Projects\Microservices\ExterneAPI\Program.cs

So there is a problem with the connected mode. Not an issue for me: it’s falling back anyways. It does that in both situations, so that doesn’t seems to be the issue.

In both projects the property ‘run on live analysis’ has been enabled.

What can I try to get SonarLint working on my second project?

Thank you.

Hello Bjorn - welcome to the community.

Can you confirm that you are analysing C# in both projects? (if so, there won’t be anything logged in the Output Window as C# analysis is controlled by VS, not SonarLint).

Do you have any exclusions configured on the Sonar server that could be preventing issues from being reported?


Thank you for your response.

The projects are both written in C#. How can I confirm that the analysis has been set to C# as well?

I don’t think exclusions are set. When I push my code to GIT, SonarQube will check it and list issues in the project where SonarLint does not seems to work. So SonarQube is scanning the project. However, SonarLint (as in the ‘Error list’ filtered at ‘current project’) does not show anything for this project.

When I select another project in the same solution, is does show findings in the error list.

I’ve compared the project file (csproj), and noticed this block:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

When I remove WarningsAsErrors, SonarLint started to work again!

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