Skip to content

Feed priority when same package is available in multiple feeds #5611

@Sam13

Description

@Sam13

Applies to all versions of NuGet.exe (v3.3.0 to 4.3.0 RC).

When a package with same id and version exists in different feeds I always assumed that the package source priority is taken from the order of package sources in the NuGet.config.

But that seems not to be true. As far as I understand the code in https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.PackageManagement/PackageDownloader.cs - GetDownloadResourceResultAsync()
all feeds are queried and the one with the shortest response time wins. Is this correct?

If so - what is the proposed solution to the following problem:
I have a private feed which is listed before the official NuGet.org feed in my NuGet.config. In my private NuGet feed I have a package with id A and version 1.2.3. Now someone else creates another package A, version 1.2.3 and uploads that to the NuGet.org feed. This package has different content than my private package.
With the current behavior of the NuGet.exe it's random which package A is downloaded.

Sure I could try to use a prefix for my private package ids that nobody else may use, but who can guarantee that this id is never used on NuGet.org in future?

By having a priority for the package sources this problem can be solved. Any other ideas?

Thanks in advance

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