DanielHWe / sonar-fxcop

FxCop plugin for C# or VB.NET projects
13 stars 6 forks source link

Some.dll was not found in any output directory (C:\path..\bin\Debug, C:\path..\bin\Release), please build project before scan. #24

Open shubhamgoel4aug opened 5 years ago

shubhamgoel4aug commented 5 years ago

Hi Team,

After upgrading the SonarQube to latest version 7.4, we are getting the following during complete sonar scan

Some.dll was not found in any output directory (C:\path..\bin\Debug, C:\path..\bin\Release), please build project before scan.

In the previous version (6.7.4), we were able to complete the scan without any issues. Our solution outputs the binaries in the agent binaries folder ($(Build.BinariesDirectory)) but FxCOp seems to look into the default directories.

The error log ends with

2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.CSharpProjectInfo.getDllPathFromExistingBinary(CSharpProjectInfo.java:141) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopProjectGenerator.getDllPathFromCsProj(FxCopProjectGenerator.java:85) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopProjectGenerator.addProjectAssemblyIfExists(FxCopProjectGenerator.java:66) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopProjectGenerator.getTargetFiles(FxCopProjectGenerator.java:49) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopProjectGenerator.generate(FxCopProjectGenerator.java:36) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopSensor.getTargetForSetting(FxCopSensor.java:281) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopSensor.executeFxCop(FxCopSensor.java:208) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:95) at org.sonar.plugins.fxcop.FxCopSensor.executeImpl(FxCopSensor.java:83) at org.sonar.plugins.fxcop.FxCopSensor.execute(FxCopSensor.java:73) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:95) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.executeImpl(FxCopSensor.java:83) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.execute(FxCopSensor.java:73)

Please help.

DanielHWe commented 5 years ago

Can you give me some more lines of the log? best ist where the error starts. What are the parameter you use for the fx cop plugin?

shubhamgoel4aug commented 5 years ago

Hi Daniel,

Thanks for the quick response, please find the below log

Sensor FxCop (cs) [fxcop] 2018-12-09T22:06:07.0958885Z 03:36:07.095 INFO: Base Dir: C:\Some_Path..\Project_Directory 2018-12-09T22:06:07.0958885Z 03:36:07.095 INFO: sonar.dotnet.visualstudio.solution.file not set 2018-12-09T22:06:07.0958885Z ##[error]03:36:07.095 WARN: FxCop plugin missed the definition of what to scan. Please set one of folowing properties:sonar.cs.fxcop.assembly, sonar.cs.fxcop.project, sonar.cs.fxcop.reportPath or sonar.cs.fxcop.slnFile 2018-12-09T22:06:07.0958885Z 03:36:07.095 WARN: FxCop plugin missed the definition of what to scan. Please set one of folowing properties:sonar.cs.fxcop.assembly, sonar.cs.fxcop.project, sonar.cs.fxcop.reportPath or sonar.cs.fxcop.slnFile 2018-12-09T22:06:07.0958885Z ##[error]03:36:07.095 WARN: Use default sln file found: C:\Path..\some.sln 2018-12-09T22:06:07.0958885Z 03:36:07.095 WARN: Use default sln file found: C:\Path..\some.sln 2018-12-09T22:06:07.1260665Z 03:36:07.126 INFO: Project key: Build_Def_clone_74:962EA895-E3E5-43CB-8B17-04465C70D390 2018-12-09T22:06:07.1260665Z 03:36:07.126 INFO: Work Dir: C\Agent_work\12.sonarqube\out.sonar\Build_Def_clone_74_962EA895-E3E5-43CB-8B17-04465C70D390 2018-12-09T22:06:07.5480248Z 03:36:07.548 INFO: FxCop start create FxCop configuration for 'C:\Path..\some.sln' 2018-12-09T22:06:07.5480248Z 03:36:07.548 DEBUG: Add 'C:\Agent_work\12\s\project.csproj' to FxCop configuration. 2018-12-09T22:06:07.5480248Z 03:36:07.548 DEBUG: Found OutputType (Library) 2018-12-09T22:06:07.5480248Z 03:36:07.548 DEBUG: Found AssemblyName (SomeAssembly) 2018-12-09T22:06:07.5665582Z 03:36:07.566 DEBUG: Found OutputPath (bin/Debug/) 2018-12-09T22:06:07.5665582Z 03:36:07.566 DEBUG: Found OutputPath (bin/Release/) 2018-12-09T22:06:07.5665582Z 03:36:07.566 INFO: C:\Path..\SomeAssembly.dll 2018-12-09T22:06:07.5665582Z 03:36:07.566 INFO: C:\Path..\SomeAssembly.dll 2018-12-09T22:06:07.5665582Z ##[error]03:36:07.566 ERROR: SomeAssembly.dll was not found in any output directory (C:\path..\bin\Debug, C:\path..\bin\Release), please build project before scan. 2018-12-09T22:06:07.5665582Z 03:36:07.566 ERROR: SomeAssembly.dll was not found in any output directory (C:\path..\bin\Debug, C:\path..\bin\Release), please build project before scan. 2018-12-09T22:06:07.7381492Z 03:36:07.738 INFO: ------------------------------------------------------------------------ 2018-12-09T22:06:07.7381492Z 03:36:07.738 INFO: EXECUTION FAILURE 2018-12-09T22:06:07.7381492Z 03:36:07.738 INFO: ------------------------------------------------------------------------ 2018-12-09T22:06:07.7381492Z 03:36:07.738 INFO: Total time: 1:33.118s 2018-12-09T22:06:07.9561336Z 03:36:07.956 INFO: Final Memory: 29M/157M 2018-12-09T22:06:07.9561336Z 03:36:07.956 INFO: ------------------------------------------------------------------------ 2018-12-09T22:06:07.9561336Z ##[error]03:36:07.956 ERROR: Error during SonarQube Scanner execution 2018-12-09T22:06:07.9561336Z 03:36:07.956 ERROR: Error during SonarQube Scanner execution 2018-12-09T22:06:07.9561336Z ##[error]java.lang.IllegalStateException: SomeAssembly.dll was not found in any output directory (C:\path..\bin\Debug, C:\path..\bin\Release), please build project before scan. 2018-12-09T22:06:07.9561336Z java.lang.IllegalStateException: SomeAssembly.dll was not found in any output directory (C:\path..\bin\Debug, C:\path..\bin\Release), please build project before scan. 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.CSharpProjectInfo.getDllPathFromExistingBinary(CSharpProjectInfo.java:141) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.CSharpProjectInfo.getDllPathFromExistingBinary(CSharpProjectInfo.java:141) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopProjectGenerator.getDllPathFromCsProj(FxCopProjectGenerator.java:85) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopProjectGenerator.getDllPathFromCsProj(FxCopProjectGenerator.java:85) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopProjectGenerator.addProjectAssemblyIfExists(FxCopProjectGenerator.java:66) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopProjectGenerator.addProjectAssemblyIfExists(FxCopProjectGenerator.java:66) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopProjectGenerator.getTargetFiles(FxCopProjectGenerator.java:49) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopProjectGenerator.getTargetFiles(FxCopProjectGenerator.java:49) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopProjectGenerator.generate(FxCopProjectGenerator.java:36) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopProjectGenerator.generate(FxCopProjectGenerator.java:36) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopSensor.getTargetForSetting(FxCopSensor.java:281) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.getTargetForSetting(FxCopSensor.java:281) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopSensor.executeFxCop(FxCopSensor.java:208) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.executeFxCop(FxCopSensor.java:208) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:95) at org.sonar.plugins.fxcop.FxCopSensor.executeImpl(FxCopSensor.java:83) at org.sonar.plugins.fxcop.FxCopSensor.execute(FxCopSensor.java:73) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:95) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.executeImpl(FxCopSensor.java:83) 2018-12-09T22:06:07.9561336Z at org.sonar.plugins.fxcop.FxCopSensor.execute(FxCopSensor.java:73) 2018-12-09T22:06:07.9561336Z ##[error]at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:45) at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:88) at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:62) 2018-12-09T22:06:07.9561336Z at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:45) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:88) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:62) 2018-12-09T22:06:07.9698212Z ##[error]at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:74) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:164) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:74) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:164) 2018-12-09T22:06:07.9698212Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:319) 2018-12-09T22:06:07.9698212Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) 2018-12-09T22:06:07.9698212Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:319) 2018-12-09T22:06:07.9698212Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:314) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:314) 2018-12-09T22:06:07.9698212Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:312) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:288) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:312) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:288) 2018-12-09T22:06:07.9698212Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) 2018-12-09T22:06:07.9698212Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48) 2018-12-09T22:06:07.9698212Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48) 2018-12-09T22:06:07.9698212Z ##[error]at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131) at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128) at org.sonarsource.scanner.cli.Main.execute(Main.java:111) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82) 2018-12-09T22:06:07.9698212Z at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) 2018-12-09T22:06:07.9698212Z at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) 2018-12-09T22:06:07.9698212Z at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131) 2018-12-09T22:06:07.9698212Z at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116) 2018-12-09T22:06:07.9698212Z at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71) 2018-12-09T22:06:07.9698212Z at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) 2018-12-09T22:06:07.9698212Z at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2018-12-09T22:06:07.9698212Z at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2018-12-09T22:06:07.9698212Z at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2018-12-09T22:06:07.9698212Z at java.lang.reflect.Method.invoke(Unknown Source) 2018-12-09T22:06:07.9698212Z at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) 2018-12-09T22:06:07.9698212Z at com.sun.proxy.$Proxy0.execute(Unknown Source) 2018-12-09T22:06:07.9698212Z at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171) 2018-12-09T22:06:07.9698212Z at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128) 2018-12-09T22:06:07.9698212Z at org.sonarsource.scanner.cli.Main.execute(Main.java:111) 2018-12-09T22:06:07.9698212Z at org.sonarsource.scanner.cli.Main.execute(Main.java:75) 2018-12-09T22:06:07.9698212Z at org.sonarsource.scanner.cli.Main.main(Main.java:61) 2018-12-09T22:06:08.0653716Z Process returned exit code 1

DanielHWe commented 5 years ago

OK, one more question to understand this, what is the defined output path of the SomeAssembly.dll?

shubhamgoel4aug commented 5 years ago

The defined output path for the assembly in the build definition is $(Build.BinariesDirectory)/$(BuildConfiguration) which points to C:/agent/_work/1/b/Release

DanielHWe commented 5 years ago

Ok, this seams to be the Problem, the plugin resolves this as C:\path..\bin\Debug, I will try to fix this.

In the meantime you can use as workaround to define sonar.cs.fxcop.assembly and/or sonar.cs.fxcop.directory to define the path to search the assemblies. See readme for more information.

shubhamgoel4aug commented 5 years ago

Hi Daniel,

Is the fixed binary released for the plugin?

Thanks

DanielHWe commented 5 years ago

Not now. Did the Workaround work?

shubhamgoel4aug commented 5 years ago

We tried, but the fix didn't seem to work, if you can provide any example.

DanielHWe commented 5 years ago

For Command line or SonarQube.Analysis.xml?

DanielHWe commented 5 years ago

I was trying to fix this but 'Build.BinariesDirectory' is resolved by the build process and not defined in the config files (.sln or .csproj) so I have no idear how to resolve it in the plugin.

shubhamgoel4aug commented 5 years ago

We are trying to do it through command line, if you can help for it? We will try to fix with script with the command line args.

DanielHWe commented 5 years ago

Then you should add _/d:"sonar.cs.fxcop.directory=C:/agent/work/1/b/Release" to the line where you call SonarQube.Scanner.MSBuild.exe begin

guvasudevanv commented 5 years ago

Is this fixed? we need a fix similar to Visual Studio bootstrapper plugin to override the output path . sonar.visualstudio.outputPaths=