Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you ignore .NET assemblies in NDepend?

Tags:

ndepend

BACKGROUND

As time goes by, I find myself more and more turning to NDepend to gain insight into the design/implementation of legacy applications.

QUESTION

Rather than adding JustMyCode to CQL queries, is there a way to permanently configure NDepend (at the project level) to simply ignore the .NET Framework? I could be wrong, but I am pretty sure that this feature was supported by NDepend v3.

EXAMPLE

  1. Open your solution in Visual Studio and click Rebuild
  2. create an NDepend project based on your solution file (*.sln)
  3. run the Analysis
  4. open the interactive (non-HTML) Dependency Graph
  5. click the Reset arrow in the top left corner (hint: the recycling icon)
  6. click reset to application assemblies only
  7. observe
    • you will no longer see references to the .Net Framework (note: the blue writing is gone)
  8. right click on one of your assemblies: Select Types
  9. click that I use directly
  10. the following CQL will appears in the queries window:
    • from t in Types where t.IsUsedBy ("MyCompany.MyProduct.MyAssemblyName") select new { t, t.NbILInstructions }
  11. observe
    • more than likely you will now see .NET Framework references (note: the blue writing is back) in the query results window
    • add JustMyCode to the CQL query and the .NET references disappear again: from t in JustMyCode.Types where t.IsUsedBy ("MyCompany.MyProduct.MyAssemblyName") select new { t, t.NbILInstructions }

CONTEXT

  • Application: NDepend version 4.1.0.6871
  • View: Dependency Graph
like image 522
Pressacco Avatar asked Nov 11 '22 16:11

Pressacco


1 Answers

The only two ways to ignore a .NET assemblies are:

  • Using notmycode/JustMyCode as you wrote
  • Remove the assembly from the Project Properties > Code to Analyze panel.
like image 66
Patrick from NDepend team Avatar answered Jan 01 '23 15:01

Patrick from NDepend team