Skip to content

Instantly share code, notes, and snippets.

@vilinski
Last active December 27, 2017 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vilinski/674d8120a90ea9ce96dfeb436950f930 to your computer and use it in GitHub Desktop.
Save vilinski/674d8120a90ea9ce96dfeb436950f930 to your computer and use it in GitHub Desktop.
bash script creating solution with two fsharp projects - console app and test project, using dotnet cli
#!/usr/bin/env bash
NAME=myprog
TEMPLATE=console
# create solution file
dotnet new sln -n $NAME
# create console project
dotnet new console -lang F# -n $NAME -o src/$NAME
dotnet sln "$NAME.sln" add "src/$NAME/$NAME.fsproj"
# create test project
dotnet new console -lang F# -n $NAME.Test -o "test/$NAME.Test"
# alternatively install and use other test project templates. For expecto:
# dotnet new -i Expecto.Template::*
# dotnet new expecto -lang F# -n $NAME.Test -o "test/$NAME.Test"
dotnet add "test/$NAME.Test/$NAME.Test.fsproj" reference "src/$NAME/$NAME.fsproj"
dotnet sln "$NAME.sln" add "test/$NAME.Test/$NAME.Test.fsproj"
# paket
mkdir .paket
wget $(curl -s https://api.github.com/repos/fsprojects/Paket/releases/latest … | grep 'browser_' | cut -d\" -f4 | grep 'bootstrapper') -q -O .paket/paket.exe
chmod +x .paket/paket.exe
mono .paket/paket.exe convert-from-nuget
# if not used expecto template already do this:
mono .paket/paket.exe add Expecto --project "test/$NAME.Test/$NAME.Test.fsproj"
# git
wget -O .gitignore https://www.gitignore.io/api/fsharp
git init
dotnet build
dotnet run --project "src/$NAME/$NAME.fsproj"
dotnet run --project "test/$NAME.Test/$NAME.Test.fsproj"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment