You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
João Moreno edited this page Mar 21, 2022
·
12 revisions
Selfhosting on Windows/WSL
This guide is for you if you want to selfhost VS Code on Windows but have a fast compile toolchain by running it in WSL.
The drawback is that running VS Code from sources actually runs on Linux which is OK for most development tasks.
Install vcxsrv, it will create a XLaunch shortcut in your Desktop`.
Download the config.xlaunch file from this gist to your user home directory C:\Users\USERNAME\.
Hit Win R and type shell:startup, hit Enter. Add a shortcut here for C:\Program Files\VcXsrv\xlaunch.exe.
Right-click, Properties on that shortcut and change Target to "C:\Program Files\VcXsrv\xlaunch.exe" -run C:\Users\USERNAME\config.xlaunch. This will make the X server launch on startup. Double click it to make sure it launches.
In WSL, add the following to the end of ~/.bashrc or equivalent:
if [ -z $DISPLAY ]; then
export DISPLAY="$(tail -1 /etc/resolv.conf | cut -d' ' -f2):0"
fi
To test everything, open a new WSL shell and sudo apt install x11-apps && xcalc. You should see an XCalc window pop up. 👍
You may see errors like Error: Can't open display: 172.20.192.1:0": open Windows Defender Firewall with Advanced Security, check inbound rules and make sure that VcXsrv windows server doesn't block private connections.