Using NuGet Package Explorer and Azure DevOps Artifacts

Hopefully this isn't a duplicate (if it is, cannot find the answer).

We are trying to store several of our common libraries as NuGet packages and our team lead created an area in the Artifacts (sorry if I fumble on the terminology) to store our packages. I have rights as a contributor and I'm trying to use Nuget Package Explorer (NPE) to create the packages and upload them. I've created a few as offline and pushed them with the command line, but would like to do so within NPE. I'd done this in a prior job but we had a different setup to store them and not in a position to go back and ask what they did.

When I launch NPE and put in the URL of our repository, I'll either get a message saying it cannot load the service index or the metadata was not found. If I go to a browser where I'm not logged on (say use Edge whereas I would normally use Chrome) I'll get a 401 error. I downloaded the NPE source and stepped through the code and at the point where it fails, the inner exception says that a 401 happened.

I've created a PAT so that I can access the repository inside of Visual Studio (2017 & 2019) and that seems to work. So not sure how to make it so that NPE will read my credentials.

And to add to the confusion, this happens when I'm at work and plugged into the local network. Last week I was working at home and everything worked just fine. I don't have to use a VPN and apparently we don't have any sort of proxy setup.

Weird. Help is appreciated, thanks!

Upvotes: 2

Views: 1004

Answers (2)

quetzalcoatl
quetzalcoatl

Reputation: 33506

The accepted answer only provided some hints how to discover what to do, here's a walkthrough:

  • if you don't have a PAT (Personal Access Token), create one

    • go to your Azure DevOps site, to UserSettings enter image description here
    • add new PAT, set a name, duration/expiration, and scope "packaging" with at "read" permission
  • edit relevant nuget.config file seen by NPE (i.e. the global one, c:\users\<ACCOUNT>\AppData\Roaming\Nuget\nuget.config)

    • add there a source that points to your nuget feed on Azure (i.e. <add key="<BLAH>" value="https://pkgs.dev.azure.com/<COMPANY>/<PROJECT>/_packaging/<FEEDNAME>/nuget/v3/index.json" />)
  • run Nuget Package Explorer

    • pick <BLAH> or https://pkgs.dev.azure.com/.., whatever the dropdown shows in the current NPE version
    • you should be presented with a typical "login+pass" popup, but keep an eye what they really ask for - paste PAT as username, ignore password
    • don't worry about seeing letters on the screenshot below, it's example garbage

enter image description here

Upvotes: 3

kartheekp-ms
kartheekp-ms

Reputation: 160

Found doc which may be helpful in your scenario. Comparing fiddler traces when NPE is accessed from your work place and remotely can provide further insights.

Upvotes: 0

Related Questions