visual studio 2010: dependency graph

前端 未结 5 1571
萌比男神i
萌比男神i 2021-02-08 14:32

I have VS 2010 professional edition. What can I do to use \"Dependency Graph\". I do not have \"architectural\" edition. Is there a FREE plugin that I could use. If not, are the

5条回答
  •  独厮守ぢ
    2021-02-08 15:10

    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"
    

    Sample Graph

提交回复
热议问题