I can get easily see what projects and dlls a single project references from within a Visual Studio .NET project.
Is there any application or use of reflection that can build me a full dependency tree that I can use to plot a graphical chart of dependencies?
In this post lets have a quick look how you can view the project dependency in Visual Studio. To view the Project Dependencies, Right Click on the Solution and select “Project Dependencies…” as shown in the image below. As shown in the above pictures all the dependent projects are “Checked” .
NDepend comes with an interactive dependency graph coupled with a dependency matrix. You can download and use the free trial edition of NDepend for a while.
More on NDepend Dependency Graph
More on NDepend Dependency Matrix:
Disclaimer: I am part of the tool team
I needed something similar, but didn't want to pay for (or install) a tool to do it. I created a quick PowerShell script that goes through the project references and spits them out in a yuml.me friendly-format instead:
Function Get-ProjectReferences ($rootFolder)
{
$projectFiles = Get-ChildItem $rootFolder -Filter *.csproj -Recurse
$ns = @{ defaultNamespace = "http://schemas.microsoft.com/developer/msbuild/2003" }
$projectFiles | ForEach-Object {
$projectFile = $_ | Select-Object -ExpandProperty FullName
$projectName = $_ | Select-Object -ExpandProperty BaseName
$projectXml = [xml](Get-Content $projectFile)
$projectReferences = $projectXml | Select-Xml '//defaultNamespace:ProjectReference/defaultNamespace:Name' -Namespace $ns | Select-Object -ExpandProperty Node | Select-Object -ExpandProperty "#text"
$projectReferences | ForEach-Object {
"[" + $projectName + "] -> [" + $_ + "]"
}
}
}
Get-ProjectReferences "C:\Users\DanTup\Documents\MyProject" | Out-File "C:\Users\DanTup\Documents\MyProject\References.txt"
(source: yuml.me)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With