Paket


paket generate-load-scripts

Allows to generate C# and F# include scripts which references installed packages in a interactive environment like F# Interactive or ScriptCS.

1: 
paket generate-load-scripts [--help] [framework <target>] [type <id>]

OPTIONS:

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
framework <target>    Framework identifier to generate scripts for, such as net4 or netcore.
type <id>             Language to generate scripts for, must be one of 'fsx' or 'csx'.
--verbose, -v         Enable verbose console output for the paket process.
--log-file <path>     Specify a log file for the paket process.
--silent, -s          Suppress console output for the paket process.
--version             Display the version.
--from-bootstrapper   Call comming from the '--run' feature of the bootstrapper.
--help                display this list of options.

If you add the -v flag, then Paket will run in verbose mode and show detailed information.

With --log-file [FileName] you can trace the logged information into a file.

Generating load scripts for all NuGet packages

It is possible to generate load scripts for all registered NuGet packages defined in the paket.dependencies file.

1: 
$ paket generate-load-scripts framework net45

This will create .csx and .fsx scripts under .paket/load/net45/, those files can now be used in your scripts without having to bother with the list and order of all dependencies for given package.

Notes:

  • this command only works after packages have been restored, please call paket restore before using paket generate-load-scripts or paket install if you just changed your paket.dependencies file
  • this command was called generate-include-scripts in V3 and used to put files under paket-files/include-scripts instead of .paket/load

Sample

Consider the following paket.dependencies file:

1: 
2: 
3: 
source https://nuget.org/api/v2

nuget FsLab

Now we run paket install to install the packages.

Then we run paket generate-load-scripts framework net45 to generate include scripts.

In a .fsx script file you can now use

1: 
2: 
3: 
#load @".paket/load/net45/fslab.fsx"

// now ready to use FsLab and any of it's dependencies

You'll see messages when you execute the #load line in FSI:

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
Loaded deedle
Loaded deedle.rplugin
Loaded dynamicinterop
Loaded foogle.charts
Loaded fsharp.charting
Loaded zlib.portable
Loaded fsharp.data
Loaded google.datatable.net.wrapper
Loaded taskparallellibrary
Loaded mathnet.numerics
Loaded mathnet.numerics.fsharp
Loaded newtonsoft.json
Loaded r.net.community
Loaded r.net.community.fsharp
Loaded rprovider
Loaded xplot.googlecharts
Loaded xplot.googlecharts.deedle
Loaded http.fs
Loaded xplot.plotly
Loaded fslab

# Generate load scripts while installing packages

Alternatively, the include scripts can be generated automatically when running the paket install command.

To enable this, add the generate_load_scripts option to the paket.dependencies file:

1: 
2: 
3: 
4: 
generate_load_scripts: true
source https://nuget.org/api/v2

nuget Suave
val id : x:'T -> 'T

Full name: Microsoft.FSharp.Core.Operators.id
val log : value:'T -> 'T (requires member Log)

Full name: Microsoft.FSharp.Core.Operators.log
type 'T list = List<'T>

Full name: Microsoft.FSharp.Collections.list<_>
Fork me on GitHub