Consider the following scenario :
- You use VSTS to build and deploy your developments
- You have set up a Nuget Feed in VSTS
- You rely on a private agent to perform the build operations
In this scenario, it is likely you will encounter the following error : ECONNREFUSED, as illustrated below :
You have probably followed the official MS documentation : https://docs.microsoft.com/en-us/azure/devops/pipelines/targets/nuget?view=vsts&tabs=designer
This all works fine with a hosted agent, but you may have problems with a private agent. In my case, I had a private agent for building BizTalk projects (can’t build those on a hosted agent unfortunately) behind a firewall.
After several hours checking my Personal Access Token, the VSTS agent configuration (its proxy configuration especially) and the Credential Manager configuration, it turned out all was fine (the Credential Manager is not even necessary!).
The problem is simply that for some reason, the Nuget tasks are unable to use the agent’s proxy configuration (I haven’t found why that was the case though)
The solution is easy enough : in your build or release definition in VSTS, simply add a variable named http_proxy :
Tadaaa! Should work like a charm now: