Let's start by spinning up an instance of Visual Studio Code. If Ionide extension is installed correctly, you should be able to create new F# project from Command Pallete (Ctrl+Shift+P).
- Open Command Pallete and select
F#: Refresh Project Templatesto use the latest templates
- Next, in Command Pallete trigger
F#: New Project
suavefrom available templates
- Specify root directory for the project to be created
- Name the project
- Wait for the project to be initialized - see note below
Note: To track the progress you can view Output pane (
Output) and select
Forgefrom dropdown. The process should end with
As we'll be using just a single project, I prefer to keep all my files, including *.fsproj and *.fs in root directory. Ionide command creates a directory for the project, so we'll need to move contents of that directory one level above:
> mv SuaveMusicStore/* .
As well as correct the relative path in
<Import Project=".paket\Paket.Restore.targets" />
Optionally remove the remaining empty directory:
> rmdir SuaveMusicStore
It's important to restrict
paket.dependencies to the same .NET version that is specified in
.fsproj file. Make sure
TargetFramework node in
.fsproj contains same .NET framework version as the one specified in
framework: >= net461
Next, let's pin versions of all dependencies, and apply binding redirects:
nuget FAKE 4.63.2 nuget FSharp.Core 4.2.3 redirects:force nuget Suave 2.2.1
Note: we'll deliberately pin all dependency versions so that this tutorial doesn't get out of date when newer versions of Suave or other dependencies arrive. The binding redirects for FSharp.Core is a good practice when creating apps, and should prevent unwanted version compatiblity issues.
paket install to apply the changes:
> .\.paket\paket.exe install --create-new-binding-files
The flag at end will make sure to create
app.config with bindings for you.
Mac / Linux
Note: If you don't already have Dotnet SDK 2.0 installed, build command will do that for you - it can take a while.
SuaveMusicStore.fs file to
App.fs to make things simpler.
Using Ionide and Visual Studio Code, you can do this with
F# Project Explorer:
- Trigger VS Code
Reload Windowfrom Command Prompt so that Ionide can refresh the .fsproj file move
- View side bar
- Navigate to
F# Project Explorer
- Right click the file
Below link allows you to explore initial Git commit with generated project.
Full name: Suave.Web.startWebServer
Full name: Suave.Web.defaultConfig
Full name: Suave.Successful.OK
Show code from this section on GitHub