Reputation: 531
I have installed and configured SonarQube 3.7.1 and sonar-runner 2.3.
While trying to run sonar-runner on a c# solution I got the error:
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Error occured while reading Visual Studio files.
ERROR: Caused by: Error while processing the project C:\root\MPS\MPA\Main\Source\MPA.Build\MPA.Build.csproj : assemblyName not defined
My sonar-project.properties looks like
sonar.projectKey=CompanyName:MPA.Android
sonar.projectName=MPA
sonar.projectVersion=1.0
sonar.sources=.
sonar.language=cs
sonar.sourceEncoding=UTF-8
\#sonar.dotnet.key.generation.strategy=safe
sonar.dotnet.visualstudio.solution.file=MPA.sln
sonar.skippedModules=MPA.Build
I would like to exclude the project MPA.Build. But it's not working.
In the MPA.sln file the MPA.Build project is defined as
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPA.Build", "MPA.Build\MPA.Build.csproj", "{A8B400F6-A5C5-4843-96CA-92B25A2E6483}" EndProject
Anyone knows how to solve this error?
when running sonar-runner -X the output is:
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:90) 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:41) Caused by: org.sonar.api.utils.SonarException: Error occured while reading Visual Studio files. at org.sonar.plugins.dotnet.core.VisualStudioProjectBuilder.createVisualStudioSolution(VisualStudioProjectBuilder.java:190) at org.sonar.plugins.dotnet.core.VisualStudioProjectBuilder.build(VisualStudioProjectBuilder.java:82) at org.sonar.api.batch.bootstrap.ProjectBuilder.build(ProjectBuilder.java:67) at org.sonar.batch.scan.ProjectReactorReady.start(ProjectReactorReady.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) at org.picocontainer.behaviors.Stored.start(Stored.java:110) at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015) at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008) at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91) at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57) at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45) 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:156) at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:144) 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.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) ... 9 more Caused by: org.sonar.plugins.dotnet.api.DotNetException: Error while processing the project C:\root\MPS\MPA\Main\Source\MPA.Build\MPA.Build.csproj : assemblyName not defined at org.sonar.plugins.dotnet.api.microsoft.ModelFactory.getProject(ModelFactory.java:364) at org.sonar.plugins.dotnet.api.microsoft.ModelFactory.getProjects(ModelFactory.java:274) at org.sonar.plugins.dotnet.api.microsoft.ModelFactory.getSolution(ModelFactory.java:198) at org.sonar.plugins.dotnet.core.VisualStudioProjectBuilder.createVisualStudioSolution(VisualStudioProjectBuilder.java:185) ... 44 more
Upvotes: 0
Views: 2765
Reputation: 31
I face the same issu today with sonarqube 5.0. I tried the "sonar.skippedModules" but this is deprecated now.
Instead, you have to use the following expression provided by the visual studio bootstraper :
sonar.visualstudio.skippedProjectPattern =
Upvotes: 0
Reputation: 3983
"assemblyName not defined" => You just have to fix the MPA.Build.csproj file that is not correct because tag "AssemblyName" is missing. See https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/csharp/Example.Core/Example.Core.csproj for example.
Upvotes: 1
Reputation: 4597
The properties file syntax you have appears to be correct. When you run sonar-runner, you should see lines like this close to the beginning of the run:
INFO - Apply project exclusions
INFO - Exclude project: MPA.Build [SomePrefix:MPA.Build]
If you don't, I would suggest running sonar-runner with the -X
argument, which will print debug statements to the console. (You'll likely want to redirect/capture the console to a log file.) This may present some additional information that could help understand why it's not seeing your exclusion.
Also, in the SonarQube web UI, while looking at the project, click the "Components" link in the left-hand navigation bar. This will list the "models" for the solution. Double-check that the name showing in this view matches MBA.Build
.
Upvotes: 0