Building Visual Studio Code for the Raspberry Pi 3

If you’d rather prefer to use Visual Studio Code for C# development instead of MonoDevelop, you can build Microsoft’s own Visual Studio Code from the source repository. I’ve used Visual Studio Code on Ubuntu and it’s actually a pretty neat tool for developing on Linux. It supports over 30 languages including C#, C++, Python, Java and more, so even if you’re not writing C# code, it’s still a useful tool.

Prerequisites for the build on Linux include Python 2.7, make and libx11-dev which should already be installed on your Pi if you started of with a Raspbian Jessie image. Also, if git has not been installed yet, run sudo apt-get install git. Nodejs and npm also need to be installed, as they will be used by the build script to retrieve some required packages. A recent version of nodejs has to be downloaded since the package version in the repository is not adequate.

wget -c http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb

Install required dependencies for running Visual Studio Code.

sudo apt-get install libnotify4 libnss3

Let’s clone the repository and start the build process.

git clone https://github.com/microsoft/vscode
cd vscode
./scripts/npm.sh install --arch=armhf

If you get an error like so:

npm ERR! Linux 4.4.14-v7+
npm ERR! Linux 4.4.14-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--arch=armhf"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: fsevents@0.3.8
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: arm

edit npm-shrinkwrap.json and delete the following lines.

"fsevents": {
  "version": "0.3.8",
  "from": "fsevents@>=0.3.1 <0.4.0",
  "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz"
},

Once the build is completed, you can run:

./scripts/code.sh

The script will download a few more required files and perform a few initialisation steps before the IDE launches. The editor performance was very poor when I ran it using X11 forwarding however. Perhaps, it works better if running within a native X11 display.

Visual Studio Code running on the Raspberry Pi 3 using X11 forwarding

Visual Studio Code running on the Raspberry Pi 3 using X11 forwarding