Paket


paket generate-load-scripts

Generate F# and C# include scripts that reference installed packages in a interactive environment like F# Interactive or ScriptCS.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
paket generate-load-scripts [--help] [--group <name>] [--framework <framework>] [--type <csx|fsx>]

OPTIONS:

    --group, -g <name>    groups to generate scripts for (default: all groups); may be repeated
    --framework, -f <framework>
                          framework identifier to generate scripts for, such as net45 or
                          netstandard1.6; may be repeated
    --type, -t <csx|fsx>  language to generate scripts for; may be repeated
    --silent, -s          suppress console output
    --verbose, -v         print detailed information to the console
    --log-file <path>     print output to a file
    --help                display this list of options.

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

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

Generate 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 loaded in your scripts without having to bother with the list and order of all dependencies for given package.

The generated load scripts will reference DLLs from the packages using #r. Additionally, all scripts in a loadscripts directory in the package will be referenced by #load, as will any script PackageName.fsx or PackageName.csx in the root of the package.

Notes:

  • This command only works after packages have been restored. Please run 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 Paket 3.x and used to put files under paket-files/include-scripts instead of .paket/load.

Generate load scripts while installing packages

Alternatively, load scripts can be generated automatically while running the paket install command.

To enable this feature, 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

Example

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 package.

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 you are ready to use FsLab and any of its dependencies.
Fork me on GitHub