Ability to restrict nuget package to specific feed #10214
Labels
Area:Settings
NuGet.Config and related issues
Functionality:Restore
Resolution:Duplicate
This issue appears to be a Duplicate of another issue
Type:Feature
(or one possible way NuGet could improve the
dotnet restore
story around failed sources)I understand that the current behavior is by design (#7035, #7015, #6373) and I'm proposing improvements to it.
Today all of our builds were broken because of
1.)
dotnet restore
requires that every single package source to be accessibleand
2.) MyGet had an outage that lasted several hours (still out as of this writing)
In my scenario, all nuget packages come from nuget.org except for 1 (one) single package that comes from a vendor - that happens to be hosted in a MyGet private feed. I tried to add one more dependency (from nuget.org) but because MyGet was down, I got an error:
My
.csproj
was changed from something like this:To something like this:
As you can see, all I've done was to add a new dependency (that would be found only in nuget.org).
I had done a
dotnet restore
previously so bothSerilog
andVendorPackage
were already in the local nuget cache (along with their own dependencies), and the newly added packageAutoMapper
in this example needed to be restored from nuget.org.Now, there seems to be a couple of issues here that I don't fully understand:
1.) Why does nuget need to try to access any on-line package sources, if I'm asking for VendorPackage v1.2.3 and it's already in the local cache along with all of its dependencies?
I would understand the need to check for new versions if I used a wildcard in the version number e.g.
<PackageReference Include="VendorPackage" Version="1.2.*" />
but I didn't... I have a very specific and hard-coded version there... That should be enough.2.) Why does nuget need to search for the package in every single source? Again, I declared
AutoMapper v10.1.1
that exists in the local nuget cache, and was found in nuget.org. Why doesn't it stop with the first feed that satisfy the hard-coded version requirement?Proposal
Regardless of the answers to the questions above, I believe the
dotnet restore
experience would improve a lot of we could define which feed(s) should be searched for each package.A new attribute on
PackageReference
e.g.Feed
could allow one or more names (CSV) of package sources that are defined in the nuget configuration (machine/local).e.g.
.csproj
nuget.config
Verbose Logs
The text was updated successfully, but these errors were encountered: