Have following log, when building a .NET C# Solution: (Verbose switch in fxcop config)
When executing the fxcopcmd.exe command on its own it works perfectly. Why doesn't it work with sonar-runner.bat?
15-Sep-2011 03:05:37 [DEBUG] Executing FxCop program...
15-Sep-2011 03:05:37 [DEBUG] No assembly specified: will look into 'csproj' files to find which should be analyzed.
15-Sep-2011 03:05:37 [DEBUG] - Found C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\Bin\Release\Company.SomeSystem.Client.dll
15-Sep-2011 03:05:37 [DEBUG] Using C:\b\SH-SHN-JOB1\Source\SomeSystem.Client as base dir when searching FxCop reference directories
15-Sep-2011 03:05:37 [DEBUG] - FxCop program : C:\Program Files\Microsoft FxCop 10.0\FxCopCmd.exe
15-Sep-2011 03:05:37 [DEBUG] - Project file : C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\.sonar\sonar.FxCop
15-Sep-2011 03:05:37 [DEBUG] - Report file : C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\.sonar\fxcop-report.xml
15-Sep-2011 03:05:37 [DEBUG] - Scanned assemblies :
15-Sep-2011 03:05:37 [DEBUG] o C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\Bin\Release\Company.SomeSystem.Client.dll
15-Sep-2011 03:05:37 [DEBUG] - Assembly dependencies :
15-Sep-2011 03:05:37 [DEBUG] o [Silverlight] C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0
15-Sep-2011 03:05:37 [DEBUG] - Ignoring generated code
15-Sep-2011 03:05:37 [DEBUG] Executing command: C:\Program Files\Microsoft FxCop 10.0\FxCopCmd.exe /p:C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\.sonar\sonar.FxCop /out:C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\.sonar\fxcop-report.xml /f:C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\Bin\Release\Company.SomeSystem.Client.dll /d:C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0 /igc /to:600 /gac
15-Sep-2011 03:05:37 [INFO] Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
15-Sep-2011 03:05:37 [INFO] Copyright (C) Microsoft Corporation, All Rights Reserved.
15-Sep-2011 03:05:37 [INFO]
15-Sep-2011 03:05:37 [INFO] Loading C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\.sonar\sonar.FxCop...
15-Sep-2011 03:05:37 [INFO] Loaded DesignRules.dll...
15-Sep-2011 03:05:37 [INFO] Loaded GlobalizationRules.dll...
15-Sep-2011 03:05:37 [INFO] Loaded NamingRules.dll...
15-Sep-2011 03:05:37 [INFO] Loaded PerformanceRules.dll...
15-Sep-2011 03:05:37 [INFO] Loading C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\Bin\Release\Company.SomeSystem.Client.dll
15-Sep-2011 03:05:37 [INFO] Using system files at: C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\mscorlib.dll.
15-Sep-2011 03:05:37 [INFO] Resolver hooked up for: 'C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\mscorlib.dll'.
15-Sep-2011 03:05:37 [INFO] Resolver hooked up for: 'C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\Bin\Release\Company.SomeSystem.Client.dll'.
15-Sep-2011 03:05:37 [INFO] Unresolved : 'Company.SomeSystem.Client' reference to Microsoft.Practices.Prism, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
15-Sep-2011 03:05:37 [INFO] Could not resolve reference to Microsoft.Practices.Prism.
15-Sep-2011 03:05:37 [INFO] The following error was encountered while reading module 'Company.SomeSystem.Client': Assembly reference cannot be resolved: Microsoft.Practices.Prism, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.HandleError(ModuleNode mod, String errorMessage)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.GetAssemblyFromReference(AssemblyReference assemblyReference)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.AssemblyReference.get_Assembly()
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.GetTypeFromRef(Int32 i, Boolean expectStruct)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.GetTypeIfNotGenericInstance(Int32 codedIndex)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.ConstructCorrectTypeNodeSubclass(Int32 i, Identifier namesp, Int32 firstInterfaceIndex, Int32 lastInterfaceIndex, TypeFlags flags, InterfaceCollection interfaces, Int32 baseTypeCodedIndex, Boolean isSystemEnum)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.GetTypeFromDefHelper(Int32 i)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.GetTypeFromDef(Int32 i)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.Reader.GetTypeList(ModuleNode module)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.ModuleNode.get_Types()
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.LanguageManager.GetFileName(ModuleNode module)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.LanguageManager.GetSourceLanguageFromSymbols(ModuleNode module)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Sdk.LanguageManager.GetSourceLanguage(ModuleNode module)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Engines.Introspection.DisplayFormatter.GetNameProvider(ModuleNode module)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Engines.Introspection.DisplayFormatter.GetDisplayName(Node node)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Engines.Introspection.LoadVisitor.FindTargetModule(ModuleNode module, TargetModuleDictionary targets)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Engines.Introspection.BaseVisitor.VisitAssembly(AssemblyNode assembly, TargetFile target)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Engines.Introspection.LoadVisitor.VisitAssembly(AssemblyNode assembly, TargetFile target)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Engines.Introspection.LoadVisitor.Load(TargetFile target, Boolean buildTree, Boolean queueItems, AssemblyNode loadedAssembly)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Engines.Introspection.IntrospectionAnalysisEngine.LoadTargets(TargetFile target)
15-Sep-2011 03:05:37 [INFO] at Microsoft.FxCop.Common.EngineManager.LoadTargets(TargetFile target, Boolean resetCounts, String loadEngine)
15-Sep-2011 03:05:37 [INFO] Could not load C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\Bin\Release\Company.SomeSystem.Client.dll.
15-Sep-2011 03:05:37 [INFO] No targets were selected.
15-Sep-2011 03:05:37 [INFO]
15-Sep-2011 03:05:37 [INFO] NOTE: One or more referenced assemblies could not be found. Use the '/directory' or '/reference' switch to specify additional assembly reference search paths.
15-Sep-2011 03:05:37 [INFO]
15-Sep-2011 03:05:37 [INFO] Could not load C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\Bin\Release\Company.SomeSystem.Client.dll.
15-Sep-2011 03:05:37 [INFO] * Analysis was not performed; at least one valid rules assembly and one valid
15-Sep-2011 03:05:37 [INFO] target file must be specified.
15-Sep-2011 03:05:37 [INFO] * 2 total analysis engine exceptions.
15-Sep-2011 03:05:37 [INFO] Writing report to C:\b\SH-SHN-JOB1\Source\SomeSystem.Client\.sonar\fxcop-report.xml...
15-Sep-2011 03:05:37 [INFO] Done:00:00:00.6876672
15-Sep-2011 03:05:38 [DEBUG] JDBC Driver [Proxy: com.mysql.jdbc.Driver@18f6235] deregistered
15-Sep-2011 03:05:38 [DEBUG] To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered
15-Sep-2011 03:05:38 [DEBUG] Delete temporary directories
15-Sep-2011 03:05:38 [DEBUG] Delete temporary directory: C:\Temp\sonar-batch48894413591140935345849622192274996
15-Sep-2011 03:05:38 [DEBUG] Delete temporary directory: C:\Temp\sonar-batch67144837301840862745763165847723383
15-Sep-2011 03:05:38 Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.sonar.api.utils.SonarException: FxCop execution failed.
15-Sep-2011 03:05:38 at org.sonar.runner.Runner.delegateExecution(Runner.java:155)
15-Sep-2011 03:05:38 at org.sonar.runner.Runner.execute(Runner.java:58)
15-Sep-2011 03:05:38 at org.sonar.runner.Main.main(Main.java:52)
15-Sep-2011 03:05:38 Caused by: org.sonar.api.utils.SonarException: FxCop execution failed.
15-Sep-2011 03:05:38 at org.sonar.plugins.csharp.fxcop.FxCopSensor.analyse(FxCopSensor.java:113)
15-Sep-2011 03:05:38 at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
15-Sep-2011 03:05:38 at org.sonar.batch.phases.Phases.execute(Phases.java:93)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.Module.start(Module.java:89)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:110)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:105)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:100)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.Module.start(Module.java:89)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:96)
15-Sep-2011 03:05:38 at org.sonar.batch.bootstrap.Module.start(Module.java:89)
15-Sep-2011 03:05:38 at org.sonar.batch.Batch.execute(Batch.java:74)
15-Sep-2011 03:05:38 at org.sonar.runner.Launcher.executeBatch(Launcher.java:60)
15-Sep-2011 03:05:38 at org.sonar.runner.Launcher.execute(Launcher.java:53)
15-Sep-2011 03:05:38 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15-Sep-2011 03:05:38 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
15-Sep-2011 03:05:38 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
15-Sep-2011 03:05:38 at java.lang.reflect.Method.invoke(Unknown Source)
15-Sep-2011 03:05:38 at org.sonar.runner.Runner.delegateExecution(Runner.java:152)
15-Sep-2011 03:05:38 ... 2 more
15-Sep-2011 03:05:38 Caused by: org.sonar.dotnet.tools.fxcop.FxCopException: FxCop execution failed with return code '521'. Check FxCop documentation for more information.
15-Sep-2011 03:05:38 at org.sonar.dotnet.tools.fxcop.FxCopRunner.execute(FxCopRunner.java:100)
15-Sep-2011 03:05:38 at org.sonar.plugins.csharp.fxcop.FxCopSensor.launchFxCop(FxCopSensor.java:151)
15-Sep-2011 03:05:38 at org.sonar.plugins.csharp.fxcop.FxCopSensor.analyse(FxCopSensor.java:111)
15-Sep-2011 03:05:38 ... 20 more
Have you tried to specify the location of the Prism assembly using the "sonar.fxcop.assemblyDependencyDirectories" key as explained in the official wiki (*) ?
Anyway you should ask for help in the user mailing list (**) and send information such as your sln file and the complete output of "mvn sonar:sonar -X"
* http://docs.codehaus.org/display/SONAR/sonar-csharp-fxcop-plugin
** http://www.sonarsource.org/support/support/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With