F# on .NET Core Ubuntu

July 24 2018 · tech fsharp linux dotnet

Installing an F# development environment on Ubuntu is easy! We use .NET Core as the runtime rather than the traditional Mono, and then install the VS Code editor with the F# extension Ionide.

First up install .NET Core. Follow the instructions on the Microsoft website. These will always be up to date and also provide installation options for non Debian based linux distributions.

By default Microsoft has telemetry enabled. This collects data about the commands run through the dotnet executable and sends the supposedly anonymised timestamp, operating system information and country it thinks your IP address belongs to. Run the command below to disable it, though one would think it should be disabled by default.

echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> ~/.bashrc
source ~/.bashrc

Now to install Visual Studio Code with the Ionide extension. When we installed .NET Core above we added the Microsoft apt repository keys to our system. We just need to add the Visual Studio Code repository and install it.

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get update
sudo apt-get install code

And install the Ionide package for F# development

code --install-extension  Ionide.Ionide-fsharp

Finally we need to configure Ionide to use dotnet core rather than mono. Open up VS Code and navigate to File -> Preferences. Search for setting FSharp.fsacRuntime by default it has value "net" which corresponds to mono. Change this value to "netcore" and restart VS Code.


Related Posts