How do I programatically create an NDepend project file?

To start, this may be a useful link: http://www.ndepend.com/NDependConsole.aspx

As anyone who has used Visual NDepend may know, with NDepends you need to import project / solution files, and the corresponding output directories, namespaces, and assemblies are added to the NDepends project.

The problem I have, is I have TONS of these projects and solutions to add. It seems ridiculous to sit there for 45 minutes adding 300 solutions click by click. There must be a way to create an NDepend project file from a list of the paths to these solution / project files.

My first thought was to find the same information NDepends does (output directories, used namespaces and output executables dll's, etc) and programmatically create the NDepend project as a massive string. However, this seems like unnecessary work.

It would be nice if there was a way to invoke the command line and target specific projects, not output directories, as some of the projects have PostBuild tasks to copy assemblies to different directories, some projects specify the output directory as an upward relative path (ie ....), and so it isn't safe to assume that the output directory of a project is the same directory it is in.

Any ideas?


Stefan, I am the lead developer of NDepend. We recently released NDepend.API that can do exactly what you are asking for.

  • NDepend.API overview
  • NDepend.API introduction
  • NDepend.API getting started
  • In the getting started section you'll find code example about how to use NDepend.API to create a temporary NDepend project initialized with assemblies generated from a Visual Studio solution.

    You can also dig into the source code of Power Tools to see how to create or modify NDepend porjects. This source code can be found in: $NDependInstallPath$NDepend.PowerTools.SourceCodeNDepend.PowerTools.sln

    链接地址: http://www.djcxy.com/p/37722.html

    上一篇: 查看上游应用程序中共享程序集更改的影响

    下一篇: 如何以编程方式创建NDepend项目文件?