Thursday, December 12, 2019

Exception 'System.AggregateException' thrown when trying to add source



I was facing this issue today related to Nuget and DLL missing in my project and was not able to proceed to look into an urgent issue.

Severity Code Description Project File Line Suppression State Suppression State
Error Exception 'System.AggregateException' thrown when trying to add source 'https://***.pkgs.visualstudio.com/_packaging/invo/nuget/v3/index.json'. Please verify all your online package sources are available.
One or more errors occurred.
Unable to load the service index for source https://invo.pkgs.visualstudio.com/_packaging/invo/nuget/v3/index.json.
Response status code does not indicate success: 401 (Unauthorized).

Solution
Un-tick package sources that are not accessible with the credentials that are being used to access Nuget or logged in for Visual Studio.

Visual Studio\Tools\Options\Nuget Package Manager\Package Sources



You can Tick specific Nuget Feed (related to your Team Project) and sign in with your VSTS team project account from VS upper right corner and restart VS




Explanation

Sometimes, when you are working for multiple client and have TFS or VS logged in under their credentials, you will not be allowed to access Nuget Package Source for different client with one credentials.
Even when you look for any Nuget package online you might get this error, the reason is under configured package source we are explicitly asking visual studio to list Nuget’s from all listed and ticked package source. 

Nuget Package Source Url : https://api.nuget.org/v3/index.json

No comments: