No issues in MSBuild analysis

I am having a similar issue to the one reported here:

It looks like the scan works but no issues are detected. I have a small console app with 2 issues identified by SonarLint but the scanner for sonarscanner.msbuild.exe does not find them.

The summary file in .sonarqube/out has this in it:
Analysis succeeded for SonarQube project “”, version Analysis results

  • Product projects: 1, test projects: 1
  • Invalid projects: 0, skipped projects: 0, excluded projects: 0

Hwever, I do get these in the output stream:
WARNING WARN: "Property Missing: ‘sonar.cs.analyzer.projectOutPaths’. No protobuf files will be loaded for this project
and
WARNING: WARN: No roslyn issues report not found for this project.

which makes me think it’s not working.

BTW, I am using 4.4.2.1543

Hi,

I’ve split this into its own topic and edited your first post to reference the topic you originally posted in.

Are you running SonarLint in connected mode? I ask because if you are not it’s possible your analysis is running with a different set of rules than is being used in SonarLint. If not, then fuller analysis logs will be helpful.

 
Ann

Interesting that you should ask that question. I am only seeing the issues underlined in the code when I am not connected to the sonarqube server. The server was recently set up and right now I am connecting to it as the admin user. Could that be a problem?

Hi,

emphasis added:

When you are not in connected mode, SonarLint applies the Sonar way profile. When you are in connected mode, SonarLint applies the same profile that would/will be applied during analysis.

So it sounds like you want to take a look at what profile is being used and what rules it contains. This may help.

 
Ann

The server is using the default SonarWay as well but there’s some kind of disconnect there since the issues disappear when I connect to the server.

Hi,

Is that the profile that’s listed on the bottom-right of the project homepage?

 
Ann

I had to delete the project bindings folder to get it to disconnect again. As soon as I bind to the project instance in the server, the issues disappear in visual studio.

Yes, right under Quality Profiles is has (C#) Sonar Way - if you click on it, it takes you to the profile and it has 215 active Rules

Hi,

I still think this is about what rules are active in the quality profile, but it may be a question of versions. SonarLint embeds its language analyzers and IIRC uses those versions only in connected mode. So you’ve probably got different versions on the server versus in SonarLint and either the profile is different or the implementation has gotten smarter.

 
Ann

All the way at the bottom of this page: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

it talks about this error. I am using the scanner for MS Build. However, when I unzip the that file, it includes the sonar-scanner-3.2.0.1227 with it - so I am assuming the MSBuild exe calls it - and gets the same error. Not sure how to proceed.

Hi,

In fact, all the other scanners use/call the vanilla SonarQube Scanner so the fact that you see it in your unzipped bundle is not surprising.

However, I thought we were talking about whether or not you see issues. When do you get the “Property missing…” notification?

 
Ann

I am seeing the same issue from the original thread (Matt Stark) when I do the SonarScanner.MSBuild.exe end command.

This is the sequence:
SonarScanner.MSBuild.exe begin /k:CSharpConsoleApp – this seems to work
MSBuild,exe /t:Rebuild – build is successful
SonarScanner.MSBuild.exe end — lots of stuff streams by and in the middle of the stream is the message about the missing property “sonar.sc.analyzer.projectOutPaths’ no protobuf files will be loaded for this project” and then “no Roslyn issues report found for this project”.

But then is says the analysis was successful - but no issues are found. The issue about the SonarLint not finding any issues in connected mode may or may not be related to this scanner issue - no idea.

thanks,
Paul

PS - when I look in the project that was created in the server, it doesn’t know it’s a C# program…

Let me throw this out there and see if it sticks: any chance your solution/project has the word “test” in it?

Yes, The Solution is named SomeConsoleApplication.sln -

within the solution are 2 projects:

  1. SomeConsoleApplication.csproj : simple console app
  2. SomeConsoleApplicationTest.csproj : unit test for said app.

I have read that the scanner is supposed to ignore projects with the word test in it - but I wasn’t aware that it would skip everything. generally, we keep our tests in a separate solution but this is just a simple solution I pulled down to see if I can get Sonarqube working. Perhaps I should try one of our real projects. One issue I have is one of our legacy projects doesn’t work with MSbuild.

tried it on another solution that doesn’t have “test” in it and I get the same error about the missing sonar.cs.analyzer.projectoutpaths property. It does create a .sonarqube.out directory with all kinds of stuff in there - just not all the right stuff I guess.

It does load the source files into the project on the server but it doesn’t identify them as C#

OK, my issue is resolved. It turned out the way my path environment variable was setup, it was executing an old version of MSBuild from .NET Framework. Once I updated it to run MSBuild v14 from Visual Studio, the scans started working. Thanks!

Hi,

Thanks for the follow up.

 
Ann