Skip to content

feat # nuget包管理下载包时,需要把依赖包也一起下载了 #74

Closed

Description

@gaoconggit

nuget包管理下载包时,需要把依赖包也一起下载了

Activity

  1. gaoconggit commented on Nov 7, 2025

    @gaoconggit
    OwnerAuthor

    @claude 实现这个

  2. claude commented on Nov 7, 2025

    @claude

    Claude finished @gaoconggit's task —— View job • claude/issue-74-20251107-0750 • Create PR ➔


    NuGet Dependency Download Feature Implementation Complete ✅

    I've successfully implemented automatic download of NuGet package dependencies.

    Tasks

    • Read project documentation and understand current architecture
    • Locate NuGet package management code
    • Analyze current package download implementation
    • Implement dependency resolution logic
    • Update package download to include dependencies
    • Build and test the implementation
    • Commit and push changes
    • Provide PR link

    Implementation Summary

    Problem: When users added NuGet packages through the package management system, only the requested package was downloaded. Dependencies were not automatically downloaded, causing potential runtime failures.

    Solution: Implemented automatic dependency resolution using the NuGet.Protocol library to recursively resolve and download all transitive dependencies.

    Changes Made

    1. Created NuGetDependencyResolver.cs (MonacoRoslynCompletionProvider/NugetHelper/NuGetDependencyResolver.cs)

    • Uses NuGet.Protocol to query NuGet API v3 for package metadata
    • ResolveDependenciesAsync(): Resolves all transitive dependencies for a single package
    • ResolveDependenciesForMultiplePackagesAsync(): Resolves dependencies for multiple packages and intelligently merges them
    • Handles version conflicts by keeping the highest version
    • Supports target framework resolution (.NET 9.0 → .NET 8.0 → .NET 7.0 → .NET 6.0 → .NET Standard 2.1/2.0)
    • Prevents circular dependency loops with processed package tracking

    2. Updated DownloadNugetPackages.cs (MonacoRoslynCompletionProvider/NugetHelper/DownloadNugetPackages.cs:125)

    • Modified DownloadAllPackagesAsync() to resolve dependencies before downloading
    • Downloads all packages (including dependencies) in parallel for performance
    • Added DownloadAllPackagesWithoutDependenciesAsync() as fallback method
    • Includes error handling with automatic fallback to original behavior if dependency resolution fails
    • Added console logging for better debugging

    3. Updated Project File (MonacoRoslynCompletionProvider/MonacoRoslynCompletionProvider.csproj:32)

    • Added NuGet.Protocol version 6.12.1
    • Added NuGet.Packaging version 6.12.1

    How It Works

    When a user adds a package (e.g., "Newtonsoft.Json,13.0.3"):

    1. System queries NuGet API v3 to get package metadata
    2. Recursively resolves all dependencies for the target framework
    3. Merges dependency lists and resolves version conflicts
    4. Downloads all packages (main + dependencies) in parallel
    5. Falls back to simple download if resolution fails

    Build Status

    ✅ Build succeeded with no errors (only pre-existing warnings)

    Next Steps


    Branch: claude/issue-74-20251107-0750 |

  3. added a commit that references this issue on Nov 7, 2025
    7d08792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions