0
votes

I have upgraded SonarQube from 3.2.1 to SonarQube 4.2.Also I have upgraded C# plugin from 1.4 to 3.3. We are using Sonar runner 2.0. Also, we have set Analysis Bootstrapper for Visual Studio to TRUE.

After upgrading i am facing the below error in most of the builds:

However,we are getting following error

"Exception in thread "main" org.sonar.runner.RunnerException: java.lang.IllegalArgumentException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".

We have added sonar.visualstudio.enable=true and also sonar.cs.fxcop.assembly to sonar.properties file.

also we have set fxcopcmd.exe path in sonar-project.properties , in sonar-runner.properties and in sonarqube under C# plugin.

edited:

Exception in thread "main" org.sonar.runner.RunnerException: java.lang.IllegalArgumentException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
 ○at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
 ○at org.sonar.runner.Runner.execute(Runner.java:151)
 ○at org.sonar.runner.Main.execute(Main.java:84)
 ○at org.sonar.runner.Main.main(Main.java:56)
 Caused by: java.lang.IllegalArgumentException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see:     http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
 ○at org.sonar.plugins.fxcop.FxCopConfiguration.checkMandatoryProperties(FxCopConfiguration.java:94)
 ○at org.sonar.plugins.fxcop.FxCopConfiguration.checkProperties(FxCopConfiguration.java:86)
 ○at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:91)
 ○at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:86)
 ○at     org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
 ○at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
 ○at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:134)
 ○at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:186)
 ○at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
 ○at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
 ○at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199)
 ○at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194)
 ○at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192)
 ○at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187)
 ○at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
 ○at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
 ○at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56)
 ○at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
 ○at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
 ○at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
 ○at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
 ○at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:144)
 ○at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:132)
 ○at  org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
 ○at             org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
○at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
○at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
○at org.sonar.batch.Batch.execute(Batch.java:103)

Thanks in advance

2
Which version of VS you are using? - Prasad Kanaparthi
we are using VS-2013 - sai

2 Answers

1
votes

SonarQube 4.2 is older than the Long-Term-Support release 4.5.x, which means it is no longer supported. I highly encourage you to upgrade to SonarQube LTS version, and use the latest C# plugin together with the MSBuild SonarQube Runner, developed jointly with Microsoft, which will make the analysis of .NET projects straightforward and easy. FxCop is natively supported by the MSBuild SonarQube Runner.

Regarding the error you are facing, you should have a look at the sonar-runner logs at the beginning of the analysis: It will tell which assemblies the Visual Studio Bootstrapper plugin is finding for each of your project. Of course, these projects need to actually have been built for the assemblies to be found! The easiest way to get rid of this error is to disable all FxCop rules from your quality profile.

0
votes

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).