DanielHWe / sonar-fxcop

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

Does not find assemblies at specific solution output directory #21

Closed rs200x closed 5 years ago

rs200x commented 5 years ago

I've configured my solution to build with a specific output directory instead of using the projects /bin/[Configuration] path.

But even if I set the parameters, FxCop is trying to find the files at the default path.

I'm starting the analysis with this:

##[debug]/d:sonar.cs.vstest.reportsPaths="D:\TfsAgent\_work\6\TestResults\*.trx" /d:sonar.cs.vscoveragexml.reportsPaths="**\*.coveragexml" /d:sonar.branch.name="master" /d:sonar.cs.fxcop.slnFile="D:\TfsAgent\_work\6\s\Seas.sln" /d:sonar.dotnet.visualstudio.solution.file="D:\TfsAgent\_work\6\s\Seas.sln" /d:sonar.cs.fxcop.directory="D:\TfsAgent\_work\6\s\Output\Debug"

Additionally sonar.cs.fxcop.slnFile is also defined within SQ to "s\Seas.sln"

In the log I get the following errors:

2018-10-03T21:25:13.2831382Z INFO: Work Dir: D\TfsAgent\_work\6\.sonarqube\out\.sonar\seas_sq_seas_sq_ABDFDC60-4574-49F8-B96C-A0C14FFFC004

2018-10-03T21:25:13.2831382Z INFO: FxCop start create FxCop configuration for 'D:\TfsAgent\_work\6\s\Seas.sln'

2018-10-03T21:25:13.2831382Z ##[error]ERROR: Servus.Common.dll was not found in any output directory (D:\TfsAgent\_work\6\s\Common\src\Servus.Common\bin\Debug, D:\TfsAgent\_work\6\s\Common\src\Servus.Common\bin\Release, D:\TfsAgent\_work\6\s\Common\src\Servus.Common\bin\DebugCodeAnalysis), please build project before scan.

2018-10-03T21:25:13.2831382Z INFO: D:\TfsAgent\_work\6\s\Common\src\Servus.Common\bin\Debug\Servus.Common.dll

2018-10-03T21:25:13.2831382Z INFO: D:\TfsAgent\_work\6\s\Common\src\Servus.Common\bin\Release\Servus.Common.dll

2018-10-03T21:25:13.2831382Z INFO: D:\TfsAgent\_work\6\s\Common\src\Servus.Common\bin\DebugCodeAnalysis\Servus.Common.dll

The all the files reside atD:\TfsAgent\_work\6\s\Output\Debug\ What's going wrong here? Why is it searching for all configurations? The build was started with Debug.

Did I miss some configuration?

DanielHWe commented 5 years ago

Sonar Qube is not Support backslashes in Settings, please use forewardslashes they will be automatically changed during usage.

rs200x commented 5 years ago

I don't believe that this is the cause.
I can't define only foreward slashes as I'm using TFS configuration variables. Anyway, as you can see in the log, the value of the sonar.cs.fxcop.slnFile parameter is taken. It's trying to run the analysis solution starting with the common project which is the very first in the build order. Its just expecting the assemblies at the wrong place, because its not recognizing that the solution was build with /p:OutDir="D:\TfsAgent_work\6\s\Output\Debug".

DanielHWe commented 5 years ago

Can you try to create a Log with verbose logging?

rs200x commented 5 years ago

I tried to get some data with sonar.verbose=true Unfortunately I can't pass the -X parameter through via the TFS SonarQube Task. sonaranalysis.zip

DanielHWe commented 5 years ago

Please check with /d:sonar.cs.fxcop.directories="D:\TfsAgent_work\6\s\Output\Debug" instead of /d:sonar.cs.fxcop.directory="D:\TfsAgent_work\6\s\Output\Debug"

rs200x commented 5 years ago

no, doesn't help

rs200x commented 5 years ago

can I expect some more help or another solution?

DanielHWe commented 5 years ago

Please give a new log after you changed to /d:sonar.cs.fxcop.directories="D:\TfsAgent_work\6\s\Output\Debug" is the folder in line ERROR: Servus.Common.dll was not found in any output directory ...

rs200x commented 5 years ago

sorry for the long delay, I had to wait for a new SQ license.

I tried with what you proposed, buts still failing 2019-01-11T20:10:01.0355938Z ##[debug]/d:sonar.cs.vstest.reportsPaths="D:\TfsAgent\_work\11\TestResults\*.trx" /d:sonar.cs.vscoveragexml.reportsPaths="**\*.coveragexml" /d:sonar.branch.name=master /d:sonar.cs.fxcop.directories="D:\TfsAgent\_work\11\s\Output\Debug\" /d:sonar.cs.fxcop.slnFile="D:\TfsAgent\_work\11\s\Seas.sln"

2019-01-11T20:34:01.0974577Z INFO: sonar.dotnet.visualstudio.solution.file not set
2019-01-11T20:34:01.0974577Z WARNING: 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

2019-01-11T20:34:01.0974577Z WARNING: WARN: Use default sln file found: D:\TfsAgent\_work\11\s\PathManagement\src\Servus.PathManagement.sln

I can see that you are close to the next release, so I will wait for it and check back again