Skip to content

CI: packed tool installation fails with NuGet package source mapping #10

Description

@goneflyin

This was generated by AI during triage.

Failure

The CI build job, attempt 2 passes Restore, Build, Test, and Pack CLI tool. It fails at Install dotnet-crap. The Self-analyze step is skipped.

.github/workflows/ci.yml runs:

dotnet tool install -g Crap4DotNet --add-source ./nupkg

The command exits with:

The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings.

This failure is in the repository's CI/NuGet configuration, not PR #4's matching code.

Cause

The root nuget.config defines one source, nuget.org, and maps * to it. The install command attempts to add the newly packed ./nupkg directory as a second source. NuGet rejects --add-source while package source mapping is active.

Fix

Use a CI-specific NuGet configuration for the tool-install step. Declare both ./nupkg and nuget.org as package sources. Map the exact package ID Crap4DotNet to ./nupkg; keep the * mapping to nuget.org for the tool's dependencies. Replace --add-source ./nupkg with --configfile <path-to-that-config> in the install command. Keep the repository's normal restore configuration unchanged.

NuGet gives an exact package-ID mapping precedence over *, so the tool package comes from the fresh pack output while other dependencies can come from nuget.org. See Microsoft's package source mapping rules and dotnet tool install options.

Acceptance criteria

  • On a clean CI runner, Restore, Build, Test, Pack CLI tool, and Install dotnet-crap all succeed.
  • The installed Crap4DotNet package comes from the package produced by that run, not from nuget.org.
  • The Self-analyze with CRAP metrics step starts. Its analysis result remains governed by its existing continue-on-error: true setting.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions