简体   繁体   中英

Add Credentials for Azure Nuget Feed in Visual Studio

I am moving my existing project to a new machine. I am using a custom Azure Nuget feed with a url in the form:

https://pkgs.dev.azure.com/company/project/_packaging/project.Libs/nuget/v3/index.json

When I try to build, I get the error:

NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/company/project/_packaging/project.Libs/nuget/v3/index.json Response status code does not indicate success: 401 (Unauthorized).

I also cannot browse the packages in the feed.

I am logged in in my browser and can see the content of the json file of the feed but of course not in a private session.

On my old machine I don't remember how the feed was added and I also haven't saved my username/password anywhere (eg in NuGet.config, which seems to be a suggested solution).

Does anyone know how to provide the credential to VS so that it can access the feed?

I was able to fix this by:

  • Logging out of Visual Studio (top right)
  • Creating a new project and adding a new Nuget feed from the URL of my Azure artifacts
  • Nuget asked me to login again and the account I had been using was listed there. I did not select it but said "use another account"
  • I logged in again with the same account, providing username, password and two factor authentication

Now everything works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM