5
votes

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
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
Hello team, Could anyone kindly update on this issue? - sripriyanka
I am able to overcome this issue by passing the parameter sonar.cs.fxcop.assembly for each module in the project. - sripriyanka
The problem is resolved after adding the below section in .csproj file of each module. <ItemGroup> <SonarQubeSetting Include="sonar.cs.fxcop.assembly"> <Value>(path to dll file)</Value> </SonarQubeSetting> </ItemGroup> - sripriyanka

1 Answers

0
votes

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.