Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to pin certain packages to a specific repository (source pinning) #6867

Closed
ghost opened this issue Apr 26, 2018 · 12 comments
Closed
Assignees
Labels
Area:PackageSourceMapping Issues related to the package source mapping feature Area:Settings NuGet.Config and related issues Epic Functionality:Restore Priority:1 High priority issues that must be resolved in the current sprint. Type:Feature

Comments

@ghost
Copy link

ghost commented Apr 26, 2018

I want to be able to say to only use a particular repository for one package, and stick to nuget.org for the others.

Example:

I've got https://dotnet.myget.org/F/dotnet-core/api/v3/index.json enabled so I can use Microsoft.Packaging.Tools.Trimming.

Unfortunately this means a whole lot of other pre-alpha packages show up as the "latest" versions available because there's no way to set priorities or preferences for package sources

maintainer edit

Design available at #10660

@jainaashish
Copy link
Contributor

Can you explain your scenario and requirement in more details? And tell us what mode NuGet UI or PMC, you used more often for such operations?

We know there is no explicit gesture to lock down a certain package from a specific repository but there are still varies ways to achieve it like you can always select a specific source to get the updates or enable/disable specific sources to do the same. And we're also working on some new features like repeatable build with package verification which cover scenarios to make sure that customer always get the same package irrespective of repository (by relying on the hash of the package).

@mwwhited
Copy link

How about when your contract library is served from a Nuget repository and you need a way to have a development local version. The hoops that must be jumped though are insane when all that would be needed is for the order of the repositories listed to be honored.

@anangaur anangaur changed the title Feature request: provide a way to pin certain packages to a specific repository Provide a way to pin certain packages to a specific repository Oct 10, 2019
@zkat zkat added the Priority:2 Issues for the current backlog. label Apr 16, 2020
@nkolev92 nkolev92 added Functionality:Restore Area:Settings NuGet.Config and related issues and removed Triage:Investigate labels Jul 1, 2020
@nkolev92 nkolev92 changed the title Provide a way to pin certain packages to a specific repository Provide a way to pin certain packages to a specific repository (source pinning) Jul 24, 2020
@JonDouglas
Copy link
Contributor

JonDouglas commented Jan 20, 2021

Hi everyone,

In an effort to start gathering more input about this issue, we'd like to invite you to schedule 30 minutes with the NuGet team to talk about potential solutions to this problem so we can shape the future of this feature.

Feel free to reserve 30 minutes in the next couple weeks here with the "Source Pinning" service:

https://aka.ms/talktonuget

Thanks!

@devbeard
Copy link

Found this issue when investigating if nuget had the same namespace pinning capabilities like npm. Would love to talk to the team, thanks for the opportunity @JonDouglas.

@JonDouglas
Copy link
Contributor

@devbeard Hey Henrik! We actually closed our calls for this about a week ago & are entering the design stage of a proposal. We'd still love any of your feedback on this thread or provided to our other team members through the call you did sign up for! We'll publish a public proposal shortly in a PR & ask those on this thread to help review.

@JonDouglas
Copy link
Contributor

For those on this thread, we've published a proposal to allow you to pin a package namespace to a source. Feel free to provide your feedback directly on the PR.

#10660

@nkolev92 nkolev92 self-assigned this Mar 12, 2021
@nkolev92 nkolev92 added Priority:1 High priority issues that must be resolved in the current sprint. and removed Priority:2 Issues for the current backlog. labels Mar 12, 2021
@nkolev92 nkolev92 added this to the Sprint 2021-03 milestone Mar 12, 2021
@dominoFire
Copy link
Contributor

@nkolev92
Copy link
Member

nkolev92 commented Apr 5, 2021

Hey all,

We will be using this issue to track the complete effort mentioned in the package namespaces proposal at #10660.

Note that this is a large feature and some parts may ship partially/experimentally earlier.

@ey250015
Copy link

We did a workaround -

  1. restore the project/solution using all sources.
  2. remove the packages that needed to be from the specific repository.
  3. remove other repositories.
  4. restore again the project/solution.

our code on docker file:
&& dotnet restore /src/MyProject/MyProject.csproj
&& rm -rf ~/.nuget/packages/certianPackege
&& dotnet nuget remove source nuget.org
&& dotnet restore /src/MyProject/MyProject.csproj
&& dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
&& dotnet restore /src/AllMySolution.sln \

@nkolev92
Copy link
Member

@ey250015

Package namespaces functionality will very soon be in early preview.

We'll update this thread when it's available to try out. We'd love to get your feedback.

@chrisraygill
Copy link
Contributor

Hi y'all! Package Source Mapping (previously Package Namespaces) is available to try out in preview! Check out the blog to learn more: https://devblogs.microsoft.com/nuget/introducing-package-source-mapping/

@JonDouglas
Copy link
Contributor

NuGet has released support for this via a new feature called Package Source Mapping. It is included in .NET 6 & NuGet 6.0.

https://docs.microsoft.com/nuget/release-notes/nuget-6.0#source-mapping

Thus we are closing this issue with a 🎉!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:PackageSourceMapping Issues related to the package source mapping feature Area:Settings NuGet.Config and related issues Epic Functionality:Restore Priority:1 High priority issues that must be resolved in the current sprint. Type:Feature
Projects
None yet
Development

No branches or pull requests