Experiments with WSL2... Yes you can use VSCode but could you run...
I'm a massive fan of WSL and now WSL2 is finally here (I've been using it during preview since day 1 but my work machine sadly couldn't run it until now...). With the Docker Desktop integration and some awesome I/O and performance metrics it really is good. This great article by Phoronix really shows how near native it is.
I often checkout some of my newer work code out in Ubuntu and then use VSCode for doing my work where appropriate however C# in VSCode is OK but it's not *great* VS2019 is still a better experience on the whole. About 2 months ago I tried JetBrains Rider 2020 out and although I liked it I couldn't quite justify using it on Windows instead of VS2019 which my work MSDN provides, however tonight I had a thought... Rider is cross platform, windows, macos and linux... could I get Rider running via WSL2 would it be awesome or horrible.... Let's find out....
22:00 Time to Start!
First I go to JetBrains website and go grab the download link for the Linux version: https://www.jetbrains.com/rider/download/#section=linux when you click the download you will get the tar.gz file and will be prompted where to save it. You could download to your Windows Downloads file and then copy to WSL but I chose to cancel it and instead copied the direct link.
With this link I crack open WSL and wget the file. It's worth providing an output file path or trimming the analytics tracking code as otherwise it downloads with a naff filename.
Once downloaded extract it: tar xvf JetBrains.Rider-2020.1.3.tar.gz, this will take a few mins...
Once extracted you can cd into the directory, theres a handy readme explaining how to run Rider on Linux but effectively cd to bin and run ./rider.sh . Now this will fail within WSL as you won't have a display yet.
But never fear, clever people have made it possible to run a X11 server via Windows and have WSL connect to it ... I know amazing! Open Windows Store and search for X11 there are a few available but I use X410, it costs but when its on offer its not too expensive. I'm going to assume you are using X410 but others will work fine. With X410 installed run it and you'll see the X icon saying its running. Originally on WSL1 this just worked but due to changes in WSL2 using Hyper-V you need to follow the instructions on the X410 website. Allow Public Access is a bit weird, hopefully WSL2 in the future will fix this (I know its on the radar).
Then run ./rider.sh again and you should see something different this time :D
You then need to activate a licence, you can get a 30 day trial licence if you want to experiment.
Everything is licenced and running :) So I hear you say.. yeah yeah is this really Rider within WSL... Open a solution ;)
Rather than mess around with a massive solution I thought for this post I'll create the inevitable Hello World Project.