Logo Paket

Learn how to use paket

Once you've installed Paket, it's time to learn how to use it!

You can refer to a minimal sample codebase that shows how Paket works in a codebase.

Core concepts

Paket manages your dependencies with three core file types:

You edit the paket.dependencies and paket.references files by hand as needed. When you run a paket command, it will generate the paket.lock file.

All three file types must be committed to source control.

Important paket commands

The most frequently used Paket commands are:

Refer to the minimal sample codebase that shows how these commands are used in a codebase.

There is a reference to all paket commands in the table of contents on the right-hand side of this page.

Walkthrough

Create a paket.dependencies file in your solution's root with the .NET CLI:

dotnet paket init

You can also create it by hand.

Make the dependencies file look like this to continue:

source https://api.nuget.org/v3/index.json

nuget Newtonsoft.Json
nuget Colorful.Console

Installing dependencies

For every project in your codebase, create a paket.references file that specifies the dependencies you want to pull in for that project.

In the minimal sample codebase, the library project has Newtonsoft.Json and the console project has Colorful.Console.

Once you have a paket.references file alongside every project in your codebase, install all dependencies with this command:

dotnet paket install

The paket install command will analyze your dependencies and automatically generate the paket.lock file. It's often quite large!

This file shows all direct and transitive dependencies and pins every dependency to a concrete version. You'll want to commit this file to your version control system (read why).

Updating packages

If you want to check if your dependencies have updates you can run the paket outdated command:

dotnet paket outdated

If you want to update all packages you can use the paket update command:

dotnet paket update

This command will analyze your paket.dependencies file and update the paket.lock file to specify all of the updated dependencies.

Type something to start searching.