Problem: While running sonar analysis on a Silverlight project today. I got an error "FxCop execution failed with return code 9 in sonar". I hope you must be knowing what sonar analysis is and why it is done. If not , you can refer my the posts starting from here.

Reason: Fxcop error code 9 means that Fxcop analysis was failed for one of the dll or project in the solution.Actually I have enabled the Fxcop Analysis in sonar analysis.

Explanation : Sometimes Fxcop Analysis failed for some projects in the solution due to various reasons. One of the reason may be that Fxcop requires some DLLs to complete the analysis. In this case the Fxcop analysis for complete solution gets failed and Fxcop exits with error code 9. This results in failure of complete sonar analysis. But do you think that it is good idea for complete sonar analysis to get failed just because Fxcop analysis failed only on one project in the solution. Its not. Is it? 

Solution: We can make use of the sonar property sonar.fxcop.assemblies to run Fxcop analysis.Provide the comma separated paths of only those dll as this property value on which we want to run Fxcop analysis. 

eg: sonar.fxcop.assemblies=pathofddl1,pathofdll2

Put this property in the file which resides in the same directory in which solution file lies. Don't provide the path of dll which is causing failure and hence exit of Fxcop resulting in failure of Sonar analysis.


Post a Comment