By using this site, you acknowledge that you have read and understand our Cookie policy, Privacy policy and Terms .

The first post about NDepend

First of all, I’d like to thank you Patrick (owner of NDepend http://www.ndepend.com) to provide me the professional license of NDepend. This is definitely a cool and powerful tool even I just started using it.

In this post, I am going to introduce the simple steps I used to detect my project’s code quality.

Install NDepend

Go to page http://www.ndepend.com/download and download the trial by simply providing your Email.

Follow the official instructions to install it (http://www.ndepend.com/docs/getting-started-with-ndepend).

Get familiar with the menu

Once installed, the NDEPEND menu will be added into the Visual Studio menu, where you can initiate code analysis. You can also do the same via NDepend Start Page links.

image

image

Starting to analyze

Click the link ‘Analyze VS solutions and VS projects’ to start analyzing.

image

In the dialog, select your solution and then click OK button to continue.

image

In the ‘Analyze a set of .NET assemblies’ dialog, you can resolve any issues highlighted in red before start the analyzing as sometimes some projects cannot be loaded or there are multiple versions can be found. Normally you can Cleanup and Rebuild your solution to fix most of the issues.

Click ‘Analyze XX .NET Assemblies’ button to continue.

image

In the result dashboard, you can find out the summary about your code quality, e.g. Code Rules violated cases, total line of code, comment lines and so forth. You can also create trend reports about these indicators.

I didn’t realize there are so many issues with my code.  I will definitely use the information NDepend provided to fix all of them.Open-mouthed smile

For example, by clicking one of the violated rule, I can get all the details and then fix them accordingly.

image

Some interesting and helpful diagrams

NDepend provides some helpful diagrams as well to help you understand your projects.

Dependency Matrix

ComponentDependenciesMatrix

Dependency Graph

ComponentDependenciesDiagram

Abstractness vs. Instability

AbstractnessVSInstability

Treemap Metric View

VisualNDependView

With all these diagrams, I will immediately know where I am not not architecting or designing well (and there are a lot places to improve apparently Embarrassed smile).

Summary

NDepend helps me to analyze my code and find out all the coding issues very quickly. I am surprised by the enormous set of rules NDepend provides to validate the code quality.  This is absolutely an powerful and great tool to use if you want to improve your code quality and to adopt the preferred coding practices in .NET. I am just a beginner in NDepend’s world but I will definitely utilize it more in future.

I noticed there are some rules which are covered by Visual Studio but not appearing in NDepend’s result but it may be because I missed them, i.e. CA2241 Provide correct arguments to formatting methods. However this won’t really impact anything. I was actually thinking whether it is possible to bring all the Microsoft defined rules into NDepend?

info Last modified by Raymond at 5 months ago * This page is subject to Site terms.

More from Kontext

local_offer .net core local_offer lite-log

visibility 2006
thumb_up 0
access_time 2 years ago

After upgrading to ASP.NET Core 2.1 (.NET Core SDK 2.1.301), you may encounter the following error about encoding: System.ArgumentException    HResult=0x80070057    Message='Cyrillic' is not a supported encoding name. For information on defining a cus...

open_in_new View open_in_new ASP.NET Core

local_offer sqlite local_offer .net core local_offer entity-framework

visibility 16890
thumb_up 1
access_time 2 years ago

SQLite is a self-contained and embedded SQL database engine. In .NET Core, Entity Framework Core provides APIs to work with SQLite. This page provides sample code to create a SQLite database using package Microsoft.EntityFrameworkCore.Sqlite . Create sample project ...

open_in_new View open_in_new .NET Framework

local_offer asp.net core 2 local_offer .net core

visibility 1893
thumb_up 0
access_time 2 years ago

In .NET Core 2.x, Windows Forms or WPF are not implemented since they are based on GDI+ and DirectX respectively in Windows. In .NET Core 3.0, there is plan to add Desktop Packs which includes UWP. WPF and Windows Forms. However, they will still be Windows-only. In .NET Core applications, you may...

open_in_new View open_in_new ASP.NET Core

local_offer .net core

visibility 5014
thumb_up 0
access_time 3 years ago

.NET core introduces a logging API that works with a number of logging frameworks. The built-in providers are configurable and extensible to support different level loggings.

open_in_new View open_in_new .NET Framework

info About author

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward
Kontext Column

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.

Learn more arrow_forward
info Follow us on Twitter to get the latest article updates. Follow us