ndepend

Exclude test projects from Ndepend Analysis


I have a visual studio solution which has a lot of projects including unit test projects. I am using NDepend API to analyze the solution. The intention is to get the relationship between methods. I am doing this by using MethodsCalled and MethodsCallingMe. Since there are test projects in the solution. I am ending up with lot many relationships as the unit testcases call the actual implementation, which is unnecessary for what I am trying to achieve.

Is there a way to exclude unit test projects when analyzing the solution?

Ndepend - exclude assembly in some ways but not others The link has some information not sure if this can be used with NDepend API.

Any help appreciated.


Solution

  • Are you getting your assemblies through this code?

    // 2) obtains assemblies file path to analyze
    var assembliesFilePath = (from vsSlnOrProjFilePath in vsSlnOrProjFilePaths
                               from assembliesFilePathTmp in visualStudioManager.GetAssembliesFromVisualStudioSolutionOrProject(vsSlnOrProjFilePath)
                               select assembliesFilePathTmp).Distinct().ToArray();
    

    What about a LINQ filtering by assembly name, something like:

    visualStudioManager.GetAssembliesFromVisualStudioSolutionOrProject(vsSlnOrProjFilePath)
    .Where(a => !a.Name.ToLower().Contains("test"))