Skip to content

NuGet is restoring packages from feeds that are not configured #14974

Description

@stevendarby

NuGet Product Used

MSBuild.exe

Product Version

.NET SDK:
Version: 10.0.301
Commit: 96856fd726
Workload version: 10.0.300-manifests.8c7d7c03
MSBuild version: 18.6.4+96856fd72

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.301\

Worked before?

No response

Impact

It's more difficult to complete my work

Repro Steps & Context

  1. Create two nuget feeds, e.g. in Azure DevOps, named something like MyFeedA and MyFeedB
  2. Publish MyPackage 1.0.0 to MyFeedA
  3. Publish MyPackage 1.1.0 to MyFeedB (note: same name, different version, different feed)
  4. Create a new solution with ProjectA and a directory nuget.config which clears existing package sources and only pulls from MyFeedA.
  5. Add a reference to MyPackage 1.0.0 in ProjectA. Build in VS.
  6. Separate directory: create a new solution with ProjectB and a directory nuget.config which clears existing package sources and only pulls from MyFeedB.
  7. Add a reference to MyPackage 1.1.0 in ProjectB. Build in VS.
  8. Return to ProjectA and update the version to 1.0.1. (note: this version doesn't exist, it's a way to trigger the particular error message through which I discovered this bug). Build in VS.

warning NU1603: ProjectA depends on MyPackage (>= 1.0.1) but MyPackage 1.0.1 was not found. MyPackage 1.1.0 was resolved instead.

The bug here is that it's resolved a package from a feed that it shouldn't consider or even be aware of. I'm wondering if the fundamental issue here is that locally cached nuget packages are not properly sorted/isolated by the feed?

Verbose Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Functionality:RestorePriority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.Type:DCRDesign Change Request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions