Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

azure devops - Unauthorized nuget package from Visual Studio Team Services using asp.net core rc2

I am unable to install/restore nuget packages from a Visual Studio Team Services feed in an asp.net core web application (RC2). I receive the following:

error: Response status code does not indicate success: 401 (Unauthorized).

I am running Visual Studio Community 2015 Update 2 and nuget version 3.4.4. I am able to install/restore packages from this feed in other project types.

Do I need to do something else to pass my credentials for an asp.net core web app?

Steps to reproduce:

From Team Services package tab I select "Connect to Feed" and copy the NuGet package source URL

In visual studio -> Tools -> NuGet Package Manager -> Package Manager settings -> Package sources and add the feed url from vso

Then from my ASP.NET Core Web Application (.NET Framework) project right click references -> Manage NuGet Packages -> Select my feed from Package source (packages are listed) -> Click to install

In output:

Installing NuGet package xxxxx 
Successfully installed xxxxx to WebApplication1
========== Finished ==========

Then it will try to restore the package at which point I get:

error: Response status code does not indicate success: 401 (Unauthorized).
error: Failed to retrieve information from remote source

And inside web project references - package has warning icon - NU1001 The dependency xxxxx could not be resolved

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I know that it's not exactly the same issue, but people may come across this one alongside as I did.

I have installed VS Community 2019? and yesterday I decided to remove the VS 2017, but after that, when I tried to restore the Nuget Packages made by the company, it started displaying an error of 401 Unauthorized.

After a few net searches I decided I didn't want to mess around with VS configurations and files, I then realized, since it's an 401 Unauthorized it's related with an account so what I did was:

  • Closed VS2019
  • Went to windows management credentials and removed all those that where related with my packages
  • Reopened VS 2019 and restored the Nuget Packages for my solution. It them asked for my credentials, set it up and all went well from here.

Here are the two accounts I removed and got recreated:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...