You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NuGet is restoring packages from feeds that are not configured #14974
Functionality:RestorePriority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.Type:DCRDesign Change Request
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
Create two nuget feeds, e.g. in Azure DevOps, named something like MyFeedA and MyFeedB
Publish MyPackage 1.0.0 to MyFeedA
Publish MyPackage 1.1.0 to MyFeedB (note: same name, different version, different feed)
Create a new solution with ProjectA and a directory nuget.config which clears existing package sources and only pulls from MyFeedA.
Add a reference to MyPackage 1.0.0 in ProjectA. Build in VS.
Separate directory: create a new solution with ProjectB and a directory nuget.config which clears existing package sources and only pulls from MyFeedB.
Add a reference to MyPackage 1.1.0 in ProjectB. Build in VS.
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?
One likely explanation is that MyPackage 1.1.0 was downloaded during your earlier restore (for the other solution+feed), and then the later restore reused that same version from the machine’s Global Packages Folder (GPF).
Could you please confirm whether MyPackage 1.1.0 already exists in your machine’s GPF?
If it is present there, NuGet may satisfy restore from the GPF.
I will confirm tomorrow but unless I've misunderstood you, that's exactly what I think the bug is. I don't think it should be able to do that; locally the cached feed packages should be separated by the feed id too.
And yep, clear is at the top of the package sources for both configs.
Thinking about your proposal to have the GPF segregated by sources. We would have to come up with a rule that says: If a package PackageA@Version is downloaded from Source1, only restores that configure Source1 can use the package. With that rule in place there is a couple of things we would have to think about
If I am using PackageA@Version in a different project but my project configures source2 not source1, I can't use the local package now because of the above rule. I would have to make an http request and download the package again. That is inefficient.
If there are n number of package sources that contain a package PackageA, we would have to download and store PackageA in the GPF n times. That is storage inefficient.
Are packages content-hash aware? If so, I could imagine a world where the per-source 'package folders' were populated by symlinks to same-content packages with zero additional download times or local file system size costs?
I'll try to answer as many of the questions as possible:
There is an implicit expectation of package id/version to be globally unique, across different sources. If you trust the sources you have defined, then you should have no concerns here.
Beyond that, to answer @baronfel's question, the global packages folder does have the content hash of the package, so if we were to switch the global packages folder to a per source location, we could theoretically use that to dedup.
As far as options for today, you can redirect the global packages folder to a repo local location, and in combination with package source mapping you should get an experience that's extremely close to what you're looking for right now.
We'll retitle this issue to refer to the global packages folder format and leave it open to get feedback:
In practice this could look something like:
gpf/sourcea/package/1.0.0 instead of gpf/packagea/1.0.0
changed the title [-]NuGet is restoring packages from feeds that are not configured[/-][+]global packages folder should have a per source package copy[/+]on Jul 9, 2026
I think the NuGet team misread this issue. The repro steps can be boiled down to: pre-populate the global packages folder with different versions of a package, then reference a version higher than what exists in the package source, but lower than what exists in the global packages folder, and NuGet will select the version from the GPF, even though the package source knows nothing about it.
This means that cleaning the GPF and then running restore again will have different results, which is a violation of NuGet's intent to be reproducible/deterministic.
The good news is that NuGet/NuGet.Client#7569 already fixes the problem, so the bug reported will be fixed in .NET 11.0.100 and VS 18.10. This issue's title has been renamed to a different scenario, so I'm not sure if the issue should be kept open for that scenario (even though it's different to the repro steps), or if the issue should be closed, since the repro steps will no longer be possible once the PR's fix ships.
changed the title [-]global packages folder should have a per source package copy[/-][+]NuGet is restoring packages from feeds that are not configured[/+]on Jul 28, 2026
Functionality:RestorePriority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.Type:DCRDesign Change Request
Activity
Nigusu-Allehu commentedon Jul 2, 2026
Thanks for the detailed repro.
One likely explanation is that
MyPackage 1.1.0was downloaded during your earlier restore (for the other solution+feed), and then the later restore reused that same version from the machine’s Global Packages Folder (GPF).Could you please confirm whether
MyPackage 1.1.0already exists in your machine’s GPF?If it is present there, NuGet may satisfy restore from the GPF.
Also, a quick clarification:
<clear />underpackageSourcesonly clears configured source entries for that property.stevendarby commentedon Jul 2, 2026
I will confirm tomorrow but unless I've misunderstood you, that's exactly what I think the bug is. I don't think it should be able to do that; locally the cached feed packages should be separated by the feed id too.
And yep, clear is at the top of the package sources for both configs.
stevendarby commentedon Jul 7, 2026
@Nigusu-Allehu any response? Problem is precisely when I have the packages cached locally.
Nigusu-Allehu commentedon Jul 7, 2026
There are multiple layers of caching. The global packages folder is where installed packages are stored. It allows better performance as you can imagine. FYI, you can override the folder path using
NUGET_PACKAGESenv variable..Thinking about your proposal to have the GPF segregated by sources. We would have to come up with a rule that says: If a package PackageA@Version is downloaded from Source1, only restores that configure Source1 can use the package. With that rule in place there is a couple of things we would have to think about
baronfel commentedon Jul 7, 2026
Are packages content-hash aware? If so, I could imagine a world where the per-source 'package folders' were populated by symlinks to same-content packages with zero additional download times or local file system size costs?
nkolev92 commentedon Jul 9, 2026
I'll try to answer as many of the questions as possible:
Beyond that, to answer @baronfel's question, the global packages folder does have the content hash of the package, so if we were to switch the global packages folder to a per source location, we could theoretically use that to dedup.
As far as options for today, you can redirect the global packages folder to a repo local location, and in combination with package source mapping you should get an experience that's extremely close to what you're looking for right now.
We'll retitle this issue to refer to the global packages folder format and leave it open to get feedback:
In practice this could look something like:
gpf/sourcea/package/1.0.0 instead of gpf/packagea/1.0.0
[-]NuGet is restoring packages from feeds that are not configured[/-][+]global packages folder should have a per source package copy[/+]zivkan commentedon Jul 28, 2026
I think the NuGet team misread this issue. The repro steps can be boiled down to: pre-populate the global packages folder with different versions of a package, then reference a version higher than what exists in the package source, but lower than what exists in the global packages folder, and NuGet will select the version from the GPF, even though the package source knows nothing about it.
This means that cleaning the GPF and then running restore again will have different results, which is a violation of NuGet's intent to be reproducible/deterministic.
The good news is that NuGet/NuGet.Client#7569 already fixes the problem, so the bug reported will be fixed in .NET 11.0.100 and VS 18.10. This issue's title has been renamed to a different scenario, so I'm not sure if the issue should be kept open for that scenario (even though it's different to the repro steps), or if the issue should be closed, since the repro steps will no longer be possible once the PR's fix ships.
[-]global packages folder should have a per source package copy[/-][+]NuGet is restoring packages from feeds that are not configured[/+]nkolev92 commentedon Jul 28, 2026
Thanks @zivkan, great point.
We'll close this issue as fixed by 7569 and I have reopened #15011 for the other topic.