Search code examples
ndependazure-pipelines-build-task

NDepend VSTS Build task run but do not produce any result


I have configured the NDepend VSTS Task as indicated but the dashboard stay empty and redirect me to the configuration doc.

I also checked the "Stop the Build when at least one Quality Gate fails" option and even if NDepend detect 2 gates failed, the build is still considered as successful.

Here is the NDepend task logs:

##[section]Starting: NDependTask
-------------------------------------------------------------
Task : NDepend Task
Description : NDepend Task
Version : 1.7.0
Author : NDEPEND
Help : Replace with markdown to show in help
-------------------------------------------------------------
Preparing task execution handler.
Executing the powershell script: d:\a_tasks\NDependTask_94137ea2-81f0-411a-9527-b1400d722332\1.7.0\ndepend.ps1

System.Management.Automation.ParameterBindingValidationException
Cannot validate argument on parameter 'Url'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
No previous build analyzed by ndepend is found to compare with.

##[warning]The ndproj file is not defined, the default one will be used

D:\a_tasks\NDependTask_94137ea2-81f0-411a-9527-b1400d722332\1.7.0\Integration\VSTS\VSTSAnalyzer.exe /outputDirectory "d:\a\1\a" /sourceDirectory "d:\a\1\s" /excludePattern ".test." /identifier "default" /hub "https://laedit2.visualstudio.com/IASI/_apps/hub/ndepend.ndependextension.NDepend.Hub" /coverageDir "d:\a\1\TestResults;d:\a\1\s;d:\a\1\s" /stopBuild /errorCode 1
Run Analysis!
2 quality gates fail.
- 'Critical Rules Violated' value 2 rules greater than fail threshold 0 rules
- 'Debt Rating per Namespace' value 1 namespaces greater than fail threshold 0 namespaces
##[error]Unexpected exit code 1 returned from tool VSTSAnalyzer.exe

##[section]Finishing: NDependTask

Do I need to configure something else?

The Visual Studio integration of NDepend works perfectly with the same ndproj on my computer.

EDIT:
I use the trial version of the task.
The problem is reproducible with the following steps:

  1. new console application (.net 4.5.2)
  2. NDepend menu in Visual Studio / Attach new NDepend project to solution
  3. publish the project to VSTS and create this build definition based on the Visual Studio proposed:
    VSTS Build Definition

And the NDepend Build Task:
enter image description here

VSTS Build result despite the Unexpected exit code 1 returned from tool VSTSAnalyzer.exe:
enter image description here

Here are the project with ndproj and the build logs.

I have noticed the following exception:

System.Management.Automation.ParameterBindingValidationException
Cannot validate argument on parameter 'Url'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.

But I cannot find the 'Url' parameter anywhere in the NDepend task definition, so I don't know if it is related.


Solution

  • Following email exchange with the VSTS team from NDepend, It appears that there was issues in the NDepend VSTS Build Task but they have been fixed.

    That said, it is worth to notice that if the "Stop the Build when at least one Quality Gate fails" option is checked and your project have some quality gates failed, the NDepend result won't be stored.
    So if your project never had a successful build, the NDepend dashboard will redirect you to the "How-To" section.