Adding NDepend for Static Code Analysis

Share This Article:

NDepend is a commercial product used to detect errors being introduced into .NET code after being committed to source control.  It looks at code from a higher perspective than other analyzers, checking relationships, OOP principles, complexity, and maintainability.  It has the ability to only look at new code to avoid full rescans, can run in Visual Studio, and can be integrated into the continuous integration build pipeline, upon which this post will focus.

Installing NDepend on Azure DevOps


Install the NDepend extension into Azure DevOps Pipelines, located here, as shown below

Setting the License

After installing NDepend, it will show up under the Overview of your AzDo Project.  Click it to be able to enter a license key, or activate a trial.  Clicking the trial will have you fill in your email, etc to get a key.  Note that you get the key immediately without email confirmation.

After the trial period, you must purchase a license and Azure Billing must configured on the account being used by Azure DevOps Pipelines.  Directions for paying for an extension are located here.

Adding NDepend to a Pipeline

Simply add the NDepend Taskto your pipeline.  You can take all the default values initially.  Later you may want to use a different NDepend Perspective or create a .ndproj file for custom scanning of your code.

For NDepend licensing to work, make sure the Phase that has the NDepend Task has Allow scripts to access the OAuth token checked.

Viewing NDepend Results

After your build runs, you can view NDepend output on the dashboard from the Overview where you entered your license key.

References

Related Articles

Need Help with an Upcoming Project