Nuget proxy usage

Dear Teamcity team,
We have a problem regarding the use of proxies when using nuget in the Teamcity. If you add the proxy server data to the nuget.config configuration file via the terminal or command line, downloading dependencies will come through the proxy server. But using the same configuration file inside the Teamcity CI system downloading dependencies does not happen through a proxy but directly. Used configuration is below:

 

  1. Set up proxy server on TeamCity ci agent
    teamcity.http.proxyHost=ip_address_of_proxy
    teamcity.http.proxyPort=port_number

teamcity.https.proxyHost=ip_address_of_proxy
teamcity.https.proxyPort=port_number

teamcity.http.nonProxyHosts=localhost|<teamcity_server_ip>
teamcity.https.nonProxyHosts=localhost|<teamcity_server_ip>

  1. Set up proxy server for nuget
    *) > nuget.exe config -set http_proxy=http://ip_address_of_proxy:port_number
    *) > nuget.exe config -set https_proxy=http://ip_address_of_proxy:port_number

  2. Run Build

0
1 comment
Hi! Both the 'NuGet Installer' and '.NET' runner steps invoke the native nuget.exe/dotnet.exe, so they should respect the proxy configuration. If you updated the NuGet.config with the proxy settings, but the executable invoked by the build agent still doesn't use proxy, it would probably mean that the build agent is started by a different user than the one whose NuGet.config has the proxy configuration.
In that case, it would not be possible to specify a custom location of the NuGet.config file in the build settings because due to this bug https://github.com/NuGet/Home/issues/747, NuGet respects only the proxy settings from the config file of the current user. The solution is to either set the proxy in the config file of the user that starts the build agent or apply a workaround from the linked issue.
0

Please sign in to leave a comment.