Skip to content

Conversation

Copy link

Copilot AI commented Sep 5, 2025

This PR implements a new deps command that creates a tree-like output structure showing project and NuGet package dependencies in a solution or specific project.

Features

Tree Visualization: The command displays dependencies in a hierarchical tree format with Unicode characters:

📦 ConsoleApp (net8.0)
  ├── LibraryA (net8.0)
    ├── 📎 Newtonsoft.Json v13.0.3
  ├── LibraryB (net8.0)
    ├── LibraryA (net8.0)
      ├── 📎 Newtonsoft.Json v13.0.3
    ├── 📎 Serilog v3.1.1
  ├── 📎 Microsoft.Extensions.Hosting v8.0.0

Flexible Analysis:

  • Analyze entire solutions: bld deps (finds all .sln files in current directory)
  • Analyze specific projects: bld deps --project MyProject.csproj
  • Recursive from root or specific project as specified in requirements

NuGet Package Control: The --nuget option allows including or excluding NuGet package references:

  • bld deps --nuget=true (default) - shows both project and package dependencies
  • bld deps --nuget=false - shows only project references

Advanced Package Support:

  • Handles central package management (Directory.Packages.props)
  • Shows package versions correctly even when centrally managed
  • Indicates private assets with [Private] annotation
  • Gracefully handles missing or unknown versions

Circular Reference Detection: Prevents infinite recursion by detecting and marking circular project references with [CIRCULAR REFERENCE].

Reusable Architecture

The implementation provides reusable components as requested:

  • DependencyAnalyzer service for building dependency trees
  • DependencyInfo, ProjectReference, PackageReference models for structured dependency data
  • DependencyNode for tree representation

This infrastructure can be easily extended for future nuget package version compatibility checking as mentioned in the requirements.

Usage Examples

# Show all dependencies for projects in current solution
bld deps

# Analyze specific project with packages
bld deps --project ./MyApp/MyApp.csproj

# Show only project references (no NuGet packages)
bld deps --project ./MyApp/MyApp.csproj --nuget=false

# Analyze with custom root directory
bld deps --root ./src

The command integrates seamlessly with the existing CLI structure and follows the same patterns as other commands in the codebase.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] create a new command deps which creates a tree like output structure showing which project in a solution references which other projects Should be recursive from a root or from a project if passed as additional argument. should take a argument --nuget ... Add deps command for dependency tree visualization Sep 5, 2025
Copilot AI requested a review from dlosch September 5, 2025 15:05
Copilot finished work on behalf of dlosch September 5, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants