29 May

Visual Studio Code Behind a Proxy

If you’re having trouble running Visual Studio Code behind a corporate proxy, the following
steps might help. Basically on a mac you just need to set two variables.

This is what will happen if you’ve got proxy problems:

osx:vscode shaw.innes$ dnu restore
Restoring packages for /Users/shaw.innes/Desktop/vscode/AkkaAkka/project.json
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console'.
Warning: FindPackagesById: System.Console
Error: ConnectFailure (Connection timed out)
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console'.
osx:vscode shaw.innes$ dnu

With the following lines at a terminal window, you’ll get much better results.

osx:vscode shaw.innes$ export http_proxy=proxy.mydomain.com:3128
osx:vscode shaw.innes$ export https_proxy=proxy.mydomain.com:3128
osx:vscode shaw.innes$ dnu restore

Restoring packages for /Users/shaw.innes/Desktop/vscode/AkkaAkka/project.json
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console'.
OK https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console' 1469ms
GET https://www.nuget.org/api/v2/package/System.Console/4.0.0-beta-22816.
OK https://www.nuget.org/api/v2/package/System.Console/4.0.0-beta-22816 1960ms
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.IO'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Runtime'.
OK https://www.nuget.org/api/v2/FindPackagesById()?Id='System.IO' 268ms
GET https://www.nuget.org/api/v2/package/System.IO/4.0.10-beta-22816.
OK https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Runtime' 1578ms
GET https://www.nuget.org/api/v2/package/System.Runtime/4.0.20-beta-22816.