Getting Started


Getting started with NDepend (3mn)


Tutorial with explanations and screenshots
  • Installing the NDepend addin for Visual Studio 2013, 2012, 2010 or 2008
  • 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 addin for Visual Studio 2013, 2012, 2010 or 2008
    1. Download the NDepend installation zip file
    2. To install NDepend, just unzip the files in a private application folder on your machine.
      Don't unzip files in '%ProgramFiles%\NDepend'. This will provoke problems because of Windows protection.
    3. If you are running NDepend Professional Version, copy your license file in the same folder where you unzipped NDepend files.
    4. Start NDepend.Install.VisualStudioAddin.exe
    5. Click the button Install for the right Visual Studio version



    6. Start Visual Studio



    Analyzing a Visual Studio solution
    1. Start Visual Studio after having installed the NDepend addin.
    2. Open the Visual Studio solution containing the code to analyze.
    3. Click the greyed NDepend circle status (bottom right of the Visual Studio window)
      OR
      click the menu NDepend > Attach new NDepend project to current Visual Studio solution
        Note:
      • 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.



    4. 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


    5. 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
    1. Start VisualNDepend.exe
    2. Select one of the options:
      • Analyze VS solutions and VS projects
      • Analyze .NET assemblies in folder
      • Analyze a set of .NET assemblies






    3. 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.