powershellnugetmyget

Register-PackageSource does not seem to work


When I try to register a package source, it seems not to have any effect.

Get-PackageSource

produces the following output:

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
nuget.org                        NuGet            False      https://api.nuget.org/v3/index.json
nuget.org v2                     NuGet            False      https://www.nuget.org/api/v2/
EventStore                       NuGet            False      https://nuget.pkg.github.com/eventstore/index.json
Microsoft Visual Studio Offline… NuGet            False      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

I then try to add a new source to a private MyGet feed:

Register-PackageSource -Name "CaaS MyGet" -Location "https://www.myget.org/F/redacted/api/v3/index.json" -ProviderName "NuGet" -Trusted

The command completes without error (there is no output at all).

Running Get-PackageSource again produces the exact same output as it did prior to running Register-PackageSource.

What am I missing?


Solution

  • It turns out that Register-PackageSource silently fails when using a v3 uri but works with a v2 uri.

    Works:

    https://www.myget.org/F/[FEED]/auth/[API_KEY]/api/v2

    Doesn't work:

    https://www.myget.org/F/[FEED]/auth/[API_KEY]/api/v3/index.json