5

We are facing issues while analyzing .NET projects using SonarQube 5.1.1.

Please note that FxCop rules are enabled at Quality profile level.

We are using MSBuild SonarQube Runner to analyze the projects. But we are facing error which says sonar.cs.fxcop.assembly must be set.

We have faced similar issue with sonar-runner-2.4 but at that time this parameter can be passed with sonar-project.properties file.

But as sonar-runner does not support .NET projects, we are using MSBuild SonarQube Runner now.

Could you kindly confirm how we can avoid these issues with MSBuild SonarQube Runner and execute FxCop rules on the .NET projects?

C# plugin version is 4.1.

Please let me know if any further information is needed from our end.

We have postponed our Production Sonar upgrade due to this issue as Project teams are NOT OK with disabling FxCop rules at Quality Profile level.

Kindly help us in fixing this.

Thanks, Sri Priyanka

  • 1
    I've got the exact same issue trying to use the MSBuild runner. We are currently using the old java runner still (and this "new" version actually just spawns that off anyway!!) which seems to work when running the analysis. However we are getting an issue with source not being shown alongside the errors and hence why I've been trying the "recommended analysis method" to see if that fixes it. – caveman_dick Aug 19 '15 at 16:42
  • So it turns out that the no source issue was the elasticsearch index. Just deleted it and restarted the server and the source is now there. Still got the fxCopAssembly issue though! :( – caveman_dick Aug 20 '15 at 08:59
  • Hello team, Could anyone kindly update on this issue? – sripriyanka Aug 24 '15 at 08:58
  • I am able to overcome this issue by passing the parameter sonar.cs.fxcop.assembly for each module in the project. – sripriyanka Aug 25 '15 at 11:01
  • You should answer your question so that other people can see how you did it! Also you will get the points... – caveman_dick Sep 07 '15 at 10:37
  • 3
    The problem is resolved after adding the below section in .csproj file of each module. (path to dll file) – sripriyanka Sep 08 '15 at 11:57
  • Thanks! You should actually add this as the answer below and then I can up-vote it. Once you have enough reputation you will be able to mark it as the answer and get the credit for it. :) – caveman_dick Sep 08 '15 at 13:01

1 Answers1

0

I thinks you should read http://www.sonarqube.org/easy-analysis-of-visual-studio-solutions-with-the-sonarqube-scanner-for-msbuild/ and http://docs.sonarqube.org/display/PLUG/C%23+Plugin .

Pay attention to the fact that you should run the commands from a "Developer Command Prompt for Visual Studio 2013 or higher" (http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+MSBuild). Neither DOS Command Prompt nor Windows PowerShell work because they don't set the proper variables.

The FxCop native support doesn't mean that it comes with MSBuild SonarQube Runner, but you have to install Visual Studio >= 2013.

Moreover, I found that not only sonar-project.properties has been deprecated, but you have to remove it to avoid strange behaviors.

Jhack
  • 510
  • 1
  • 6
  • 20