How to test f# on linux?

Member

by rylan , in category: General Help , 9 months ago

How to test f# on linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by damian_mills , 9 months ago

@rylan 

To test F# on Linux, follow these steps:

  1. Install .NET Core: F# runs on .NET Core, so you need to install it first. Open a terminal and run the following commands: wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb sudo apt-get update sudo apt-get install -y apt-transport-https sudo apt-get update sudo apt-get install -y dotnet-sdk-5.0
  2. Verify the installation: After the installation is complete, you can verify it by running the following command: dotnet --version
  3. Install an F# development environment: There are several options available to write F# code. One of the popular options is Visual Studio Code. You can install Visual Studio Code by running the following command: sudo apt-get install -y code
  4. Install the Ionide-FSharp extension: Open Visual Studio Code, click on the Extensions tab on the sidebar, search for "Ionide-FSharp" extension, and install it.
  5. Create a new F# project: Open a terminal, navigate to the desired location, and run the following command to create a new F# project: dotnet new console -lang F#
  6. Write and run F# code: Open the project folder in Visual Studio Code, open the "Program.fs" file, write your F# code, and save it. To run the code, open a terminal and run the following command in the project folder: dotnet run


That's it! You have successfully tested F# on Linux using .NET Core and Visual Studio Code.

by aliya.yundt , 4 months ago

@rylan 

To test F# on Linux, follow the steps outlined below:

  1. Install .NET Core: F# runs on .NET Core, so start by installing it. Open a terminal and run the following commands:
  • Download the Microsoft package repository configuration file:
1
wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb


  • Install the package repository configuration:
1
sudo dpkg -i packages-microsoft-prod.deb


  • Update the package list:
1
sudo apt-get update


  • Install the required packages for package management over HTTPS:
1
sudo apt-get install -y apt-transport-https


  • Update the package list again:
1
sudo apt-get update


  • Install the .NET SDK:
1
sudo apt-get install -y dotnet-sdk-5.0


  1. Verify the installation: After the installation is complete, check the installed .NET Core version by running:
1
dotnet --version


  1. Install an F# development environment: Install Visual Studio Code by running:
1
sudo apt-get install -y code


  1. Install the Ionide-FSharp extension: Open Visual Studio Code, go to the Extensions tab on the sidebar, search for "Ionide-FSharp" extension, and install it.
  2. Create a new F# project: Open a terminal, navigate to your desired location, and run the following command to create a new F# project:
1
dotnet new console -lang F#


  1. Write and run F# code: Open the project folder in Visual Studio Code, access the "Program.fs" file, write your F# code, and save it. To run the code, open a terminal and run the following command in the project folder:
1
dotnet run


By following these steps, you can successfully test F# on Linux using .NET Core and Visual Studio Code.