Logo Paket

paket add

Add a new dependency.

paket add [--help] [--version <version constraint>] [--project <path>] [--group <name>]
          [--create-new-binding-files] [--force] [--interactive] [--redirects] [--clean-redirects]
          [--no-install] [--no-resolve] [--keep-major] [--keep-minor] [--keep-patch]
          [--touch-affected-refs] [--type <packageType>] <package ID>

NUGET:

    <package ID>          NuGet package ID

OPTIONS:

    --version, -V <version constraint>
                          dependency version constraint
    --project, -p <path>  add the dependency to a single project only
    --group, -g <name>    add the dependency to a group (default: Main group)
    --create-new-binding-files
                          create binding redirect files if needed
    --force, -f           force download and reinstallation of all dependencies
    --interactive, -i     ask for every project whether to add the dependency
    --redirects           create binding redirects
    --clean-redirects     remove binding redirects that were not created by Paket
    --no-install          do not modify projects
    --no-resolve          do not resolve
    --keep-major          only allow updates that preserve the major version
    --keep-minor          only allow updates that preserve the minor version
    --keep-patch          only allow updates that preserve the patch version
    --touch-affected-refs touch project files referencing affected dependencies to help incremental
                          build tools detecting the change
    --type, -t <packageType>
                          the type of dependency: nuget|clitool (default: nuget)
    --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.

Adding to a project

By default packages are only added to the solution directory, but not on any of its projects. It's possible to add the package to a specific project:

paket add <package ID> --project <project>

See also paket remove.

Example

Consider the following paket.dependencies file:

source https:/nuget.org/api/v2

nuget FAKE

Now we run paket add NUnit --version '~> 2.6' --interactive to install the package:

$ paket add NUnit --version '~> 2.6' --interactive
Paket version 5.0.0
Adding NUnit ~> 2.6 to ~/Example/paket.dependencies into group Main
Resolving packages for group Main:
 - NUnit 2.6.4
 - FAKE 4.61.3
Locked version resolution written to ~/Example/paket.lock
Dependencies files saved to ~/Example/paket.dependencies
  Install to ~/Example/src/Foo/Foo.fsproj into group Main?
    [Y]es/[N]o => y

Adding package NUnit to ~/Example/src/Foo/paket.references into group Main
References file saved to ~/Example/src/Foo/paket.references
  Install to ~/Example/src/Bar/Bar.fsproj into group Main?
    [Y]es/[N]o => n

Performance:
 - Resolver: 12 seconds (1 runs)
    - Runtime: 214 milliseconds
    - Blocked (retrieving package details): 86 milliseconds (4 times)
    - Blocked (retrieving package versions): 3 seconds (4 times)
    - Not Blocked (retrieving package versions): 6 times
    - Not Blocked (retrieving package details): 2 times
 - Disk IO: 786 milliseconds
 - Average Request Time: 1 second
 - Number of Requests: 12
 - Runtime: 14 seconds

This will add the package to the selected paket.references files and also to the paket.dependencies file. Note that the version constraint specified the in the above command was preserved.

source https:/nuget.org/api/v2

nuget FAKE
nuget NUnit ~> 2.6

Type something to start searching.