Getting Started with NDepend
- Either watch the 3 minutes video below...
- ... or read the tutorial with explanations and screenshots
- Once you got the product installed and running don't miss out the Walkthrough Videos
Getting started with NDepend (3mn)
Tutorial with explanations and screenshots
- Installing the NDepend extension for Visual Studio 2019, 2017, 2015, 2013, 2012 or 2010
- Analyzing a Visual Studio solution
- Analyzing a .NET applications using Visual NDepend
- What does the NDepend report tell me about my code?
- I want to go further to have a better control over my code
Installing the NDepend extension for Visual Studio 2019, 2017, 2015, 2013, 2012 or 2010
- Download the NDepend installation zip file
- To install NDepend, just unzip the files in a private application folder on your machine. Don't unzip files in '%ProgramFiles%\NDepend'. This might provoke problems because of Windows protection.
- If you are running NDepend Professional Version, just type your license key in the NDepend activation dialog to activate your machine.
- Start NDepend.VisualStudioExtension.Installer.exe
- Click the button Install for the right Visual Studio version
- Start Visual Studio
Analyzing a Visual Studio solution
- Start Visual Studio after having installed the NDepend addin.
- Open the Visual Studio solution containing the code to analyze.
Click the greyed NDepend circle status (bottom right of the Visual Studio window)
click the menu NDepend > Attach new NDepend project to current Visual Studio solution
- A NDepend project can be attached to several Visual Studio solutions.
- This is useful if you wish to analyze several .NET assemblies compiled with several Visual Studio solutions.
- A benefit will be the possibility to navigate across several Visual Studio solutions opened in several Visual Studio instances.
- The dialog opened has been populated with .NET assemblies of the Visual Studio solution. Here you can add more .NET assemblies compiled from another solutions
- Click Ok : the NDepend analysis start. It will just take a few seconds to analyze your code base for the first time.
Analyzing a .NET applications using Visual NDepend
- Start VisualNDepend.exe
Select one of the options:
- Analyze VS solutions and VS projects
- Analyze .NET assemblies in folder
- Analyze a set of .NET assemblies
- Click OK. It will trigger the analysis of your assemblies and code source by NDepend.Console.exe. This analysis will take a few seconds to a few minutes depending on the size of the assemblies. Once done, the result is displayed in the VisualNDepend.exe UI.
What does the NDepend report tell me about my code?
- Application Metric: This section gives you an idea of the topology of your application.
- Assembly Metric: This section gives you an idea of the size of each assembly within your application in terms of #IL instructions and others metrics.
- VisualNDepend View: This section illustrates the size of your assemblies, namespaces, types and methods in terms of #IL instructions. You can browse this view dynamically by clicking the Launch Visual NDepend on this Project icon in the NDepend.Project UI.
- Assembly Abstracness vs. Instability: This section illustrate the Abstracness/Instability principle explained in the assemblies metrics section.
- Assembly Dependencies: This section shows all dependencies between assemblies of your application in a table.
- Assembly Dependency Diagram: This section shows all dependencies between assemblies of your application in a diagram
- Assembly build order: This section gives you one of the possible build order for your assemblies. If a cycle exists in your assemblies dependencies graph, this section will report it.
NDepend information and warnings:
This sections gives you advices about your code:
- It warns you when an assembly depends on a less stable assembly than itself.
- It warns you when the visibility of a type or of a member is not optimal (in the context of the analysed application).
- It warns you when a type or a member is not used (in the context of the analysed application).
- CQLinq Queries and Rules: This section reports default CQLinq rules which have been violated. More about CQLinq here.
- Type Metrics: This section recaps type metrics in a table. A link to the documentation is provided for each metric.
I want to go further to have a better control over my code
- Understand metrics yielded by NDepend and read recommendations.
- Get a new understanding of your code by playing with the NDepend panels. Modify the view with the Level and Metric combo boxes.
- Tune your report thanks to the Output panel in the NDepend.Project UI.
- Learn CQLinq, adapt existing CQLinq code rules and create your own ones.
- Integrate the NDepend report in your daily build process. Facilities are provided for both MSBuild and NAnt build technologies. Read the ReadMe.txt files contained in the .\MSBuild\ and .\NAnt\ folders.