Introduction to F# in Mac OS
In short we will be setting up in the below order.
- Install .NET Core.
- Install VS Code.
- Install Ionide.
Installing .NET Core
Download and install .NET Core SDK from .NET Core for Mac.Installing VS Code
Download Visual Studio Code for Mac and Install.Installing Ionide
Ionide is a plugin to support F# language features for VS Code. Open VS Code, pressCmd+P
and enter the commandext install Ionide-fsharp
to install the Ionide package.
Or search ionide in VS Code extensions and install from there.Hello World
- Create a solution to have multiple projects.If we did not specify thedotnet new sln --name Everything
--name
it will take the folder name as the solution name. - Create F# console project and add it to the solution.In above commanddotnet new console -lang f# -o hwFSharpApp
-o hwFSharpApp
sets an output directory of hwFSharpApp and creates hwFSharpApp.fsproj.console -lang F#
will create a console app in F# language.This will add projectdotnet sln add hwFSharpApp/hwFSharpApp.fsprojhwFSharpApp/hwFSharpApp.fsproj
to the solution. - Build and run.
The below command will build the solution with all the projects.To run the console application use the below command withdotnet build Everything.slndotnet run
which specifies the projects to run.dotnet run --project hwFSharpApp/hwFSharpApp.fsproj - Use VS Code to edit.
Using VS Code open the folder with solution(Everything.sln) we created. We can use the F# Project Explorer to Build Run and Debug the F# Projects by setting it as startup project.
Use--help
to explore more options in .NET CLI.More Details
1) Use F# on Mac OSX
2) Get started with F# and .NET Core