1

In my company, NuGet packages are coming from different sources:

When I start up Visual Studio, I get logged in automatically (at the above right corner, I can see my login settings).

I have access to some NuGet packages and there are some where I don't have access to:

  • Company.Something.UA : OK
  • ControlzEx : OK
  • DevExpress.Chartsv18.2_Core : NOK

I have been doing NuGet restore in lots of ways: normal commandline, developer prompt, using the standard NuGet.exe, using the latest NuGet.exe, from within the company network, from outside the company network, ..., it does not make any difference.

In order to pinpoint the problem, I was thinking of restoring a single NuGet package, which should come from one specific package source, but what is that source?
When checking the properties of NuGet packages (being OK or not), the package source is not mentioned.

So I would like to do:

NuGet.exe restore DevExpress.Chartsv18.2_Core DevExpress..._Core_Package_Source
  • How can I do that?
  • How can I know from which package source I need to download a specific NuGet package?
1
  • What is your origin problem? Nov 10, 2021 at 21:21

2 Answers 2

4

There is no link. Package restore searches all sources in nuget.config (either system-defined or project-defined) for a package, in the order those sources are specified, and installs the first matching package it finds.

What you're really asking is "how do I install a package from a specific source", and you can do that with dotnet restore. Note that NuGet.exe is legacy and deprecated; its package restore functionality is integrated into the dotnet tool and improved there.

> dotnet restore MyPackage -s NugetSourceName

There is no way to know which source a package is available in without browsing it, but as stated above it shouldn't matter; package restore will figure it out.

2

Now (with .NET 6 tooling) you do have a way to pin packages (patterns) to specific package sources. The feature is called "Package Source Mapping":

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.