Sonarqube 6.0 fails analysis with fxcop rules

834 views
Skip to first unread message

kanishk...@gmail.com

unread,
Nov 18, 2016, 11:42:36 AM11/18/16
to SonarQube
My Sonarqube analysis fails giving me an error that FXCop analysis is not done and that I should use the latest version of Sonar Scanner for MSBuild or disable the FXCop rules. When I disable the FXCop rules, the analysis works fine for all other rules. But before this, I had been using Sonarqube 5.1 with Sonar Scanner 2.2 and everything worked fine. I'm not sure where I'm going wrong as I have double checked sonar-project.properties as well as sonar-scanner.properties. I'm using the latest version of all plugins except C# plugin which is 5.3 instead of 5.5 because 5.5 still has a bug when scanning code. I'm also using the latest version of Sonar-scanner which is 2.8. I can't use SonarScanner for MSBuild as the latest version requires the project to be built with MSBuild 14.0 which I don't have access to. Which is why I continue to use Sonar Scanner 2.8.

I trigger my build via Jenkins.

My setup:

1) Sonarqube 6.0 (Sonar-scanner 2.8)

2) Visual Studio 2013 (MSBuild 12.0, FXCop Static Tools installed)

3) Jenkins 1.6


10:17:30.150 INFO  - Sensor org.sonar.plugins.csharp.CSharpSensor (done) | time=49235ms
10:17:30.150 INFO  - Sensor org.sonar.plugins.csharp.CSharpFxCopProvider$CSharpFxCopSensor
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1:13.657s
Final Memory: 12M/367M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
	at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
	at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
	at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
	at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
	at org.sonar.runner.api.Runner.execute(Runner.java:100)
	at org.sonar.runner.Main.executeTask(Main.java:70)
	at org.sonar.runner.Main.execute(Main.java:59)
	at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalArgumentException: No FxCop analysis has been performed on this project, whereas it contains cs files: Verify that you are using the latest version of the SonarQube Scanner for MSBuild, and if you do, please report a bug. In the short term, you can disable all FxCop rules from your quality profile to get rid of this error.
	at org.sonar.plugins.fxcop.FxCopConfiguration.checkMandatoryProperties(FxCopConfiguration.java:104)
	at org.sonar.plugins.fxcop.FxCopConfiguration.checkProperties(FxCopConfiguration.java:95)
	at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:96)
	at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:91)
	at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:184)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:78)
	at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
	... 9 more
ERROR: 
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.


My sonar-project.properties file:

sonar.projectKey=PKey

sonar.projectName=PName

sonar.sources=.
sonar.language=cs

sonar.visualstudio.enable=false
sonar.visualstudio.solution=Project.sln
sonar.visualstudio.skipIfNotBuilt=true
sonar.visualstudio.testProjectPattern=.*UnitTest.*

sonar.scm.disabled=false
sonar.scm.provider=tfvc
sonar.tfvc.username=username
sonar.tfvc.password.secured=pass
sonar.tfvc.collectionuri=http://url

sonar.sourceEncoding=UTF-8

sonar.cs.vstest.reportsPaths=*.trx



G. Ann Campbell

unread,
Nov 18, 2016, 3:00:51 PM11/18/16
to SonarQube, kanishk...@gmail.com
Please don't cross-post here and on StackOverflow


Ann

kanishk...@gmail.com

unread,
Nov 18, 2016, 3:14:09 PM11/18/16
to SonarQube, kanishk...@gmail.com
Sure. I deleted the question on Stackoverflow. 

Tamas Vajk

unread,
Nov 22, 2016, 5:39:09 AM11/22/16
to kanishk...@gmail.com, SonarQube
Hello,

Are you using the Scanner for MsBuild to analyze your project or are you trying to directly run the Scanner CLI? The latter option is not supported, all .NET analysis should be done with the Scanner for MsBuild.

Scanner for MsBuild supports at the moment both msbuild12 and msbuild14. So you can use the latest version. Your issue doesn't seem to be related to Jenkins, can you reproduce it on your local dev machine by running the Scanner for MsBuild begin and end steps, and in between the build?

As a side note: I don't see how come you can't have msbuild14 on your build machine. MsBuild is not tied any more to VS versions, you can simply install it from here: https://www.microsoft.com/en-us/download/details.aspx?id=48159

Regards,
Tamas


Tamas VAJK | SonarSource
Language Team

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/9ffd22f6-24b4-4d88-8ba9-e5948fe02154%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

kanishk...@gmail.com

unread,
Nov 22, 2016, 8:37:11 PM11/22/16
to SonarQube, kanishk...@gmail.com
Hi Tamas, thank you so much for your response! The build was successful with the use of MSBuild 12.0. 

However, it was failing with MSBuild 14.0 with the following error:

"CSC : error CS1566: Error reading resource 'file-name.dll.licenses'

Upon checking with google, it looks like the error might be cause my solution is configured for VS 2013 and not VS 2015? Not entirely sure though.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.

Tamas Vajk

unread,
Nov 29, 2016, 8:57:03 AM11/29/16
to Kanishka Goel, SonarQube
Hello,

What is the .dll.licenses file?
CS1566 is a compiler error. Is that file being passed to CSC? Maybe your project is specifying that as a Compile item, while it's not a code file.

Tamas

Tamas VAJK | SonarSource
Language Team

To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/dbdf5586-bb77-4fa9-8e78-d5725154be6e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages