How do I get a bare bones F# app to compile with Paket?

125 Views Asked by At

Consider the following script below. I'm not sure what it takes to get my app to compile using Paket and I'm sure it's something small I'm missing. Does anyone have any insight?

dotnet new console -n PaketApp -lang "F#" -o .
dotnet new tool-manifest
dotnet tool install paket
dotnet paket init
dotnet paket auto-restore on
dotnet paket add FParsec --project PaketApp

"open FParsec" > "Program.fs"

dotnet build

At the very least, I can get this script to compile the dotnet app, but I'm not really sure what convert-from-nuget is actually doing.

dotnet new console -n PaketApp -lang "F#" -o .
dotnet add package FParsec
dotnet new tool-manifest
dotnet tool install paket
dotnet paket convert-from-nuget

"open FParsec" > "Program.fs"

dotnet build

.NET sdks on my machine:

dotnet --list-sdks
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
3.1.200 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
1

There are 1 best solutions below

3
maciek On

When you ran the first snippet, paket.references file for your project is not created. You can create it manually and just put FParsec in it. Then run dotnet paket install and dotnet build to compile your application.

edit: also, target framework in paket.dependencies needs to be changed to framework: net5.0, by default it's framework: netcoreapp3.1, netstandard2.0, netstandard2.1. I don't see an option in paket init to set a different framework.

Related Questions in F#