I have a private feed from GitHub that I added to Nuget.config
file:
<add key="github" value="https://nuget.pkg.github.com/..." />
I can confirm it works by using dotnet nuget list source
(see screenshot below).
However when running dotnet add package -s github PackageName
, it fails with "There are no versions available for the package" error. Removing the -s github
works (and it installs from the Private feed if it is on the top).
Although I can manually run it for myself (removing -s
), I am writing a script to install it for other developers. I need to reliably install it from the private feed even if it's not on the top of the list. There may be packages in nuget.org
with the same name in our private feed.
Why does specifying package source with -s
not work? How do I fix it?
CodePudding user response:
The Microsoft docs are saying:
-s|--source <SOURCE>
The URI of the NuGet package source to use during the restore operation.
So I'd expect the command to be like this:
dotnet add package -s https://nuget.pkg.github.com/... PackageName