Search code examples
sonarqubesonarqube-msbuild-runner

C# projects analyzed with MSBuild.SonarQube.Runner: SQ doesn't show source code with rule violations


I analyze C# projects using MSBuild.SonarQube.Runner-2.1:

  1. MSBuild.SonarQube.Runner.exe begin /k:"%SKEY%" /n:"%SNAME%" /v:"%SVERSION%"
  2. "c:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:Rebuild
  3. MSBuild.SonarQube.Runner.exe end

The analysis works fine and the analyzed project is created on SQ.

The problem is that when I click at 'Issues' on the project's site on SQ and then double-click at an issue then the source code with the corresponding rule violation is NOT shown! Why?

SQ version: 5.3. VS version: 2015.


Solution

  • I think I found the reason: it were all fxcop rules which were violated. And fxcop analyzes the compiled managed code which makes it impossible to associate the rule violation with a concrete line of code.

    Among all the fxcop rule violations I also found one stylecop rule violation in the project. For this violation the source code was displayed because stylecop analyzes the source files.