0

I try to run mvn sonar:sonar and I get this:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project YamarinArtifactId: Can not execute Sonar: FxCop execution failed. FxCop execution failed with return code '521'. Check FxCop documentation for more information. -> [Help 1]

Any ideas what to do?

tplehton
  • 21
  • 1
  • 4
  • If you google on this, you can find some similar cases already posted (like this one: http://stackoverflow.com/questions/7441489/sonar-c-sharp-eco-system-fxcop-error-code-521). You can run the analysis in Debug mode ('-X') to have more information (and post here more info). I'd bet that you haven't configured your project properly and the C# plugins can't find the assembly to analyse. – Fabrice - SonarSource Team Apr 25 '12 at 14:15

2 Answers2

0

Thanks, "mvn sonar:sonar -X" showed the location of fxcop log file, which then contained an error (missing .dll)

tplehton
  • 21
  • 1
  • 4
0

Error 521 is because of the missing DLLs. You have to set the value of sonar.fxcop.assemblyDependencyDirectories property in the sonar-runner (client).

The value of this should be the Comma-seperated list of path patterns to locate the directories where dependency assemblies can be found. These paths can be absolute or relative, the starting point being the folders where the csproj files are located. Also the special key "$(SolutionDir)" can be used to build a path relative to the root folder of the solution (i.e. where the sln file is located). Check out the note at the bottom of this page for more details. E.g.: "$(SolutionDir)/**/libs" (and not "$(SolutionDir)/**/libs/*.dll")

eg : I set the value as

sonar.fxcop.assemblyDependencyDirectories=$(SolutionDir)/**/libs,$(SolutionDir)/**/Debug

and the things started working for me. :)

Abhishek Gahlout
  • 3,132
  • 2
  • 20
  • 28