Paket installation
This guide will show you
- How to install Paket as a .NET tool, for a repository or for your machine.
- How to restore packages before the build of a solution without the .NET SDK.
- How to move from
paket.exeand the bootstrapper. - Install editor support.
- Set up shell completion for Paket commands.
Paket is a .NET tool: it needs the .NET SDK and runs on Windows, Linux and macOS. It manages the dependencies of any project, including the projects that target the .NET Framework.
Local tool
A local tool pins the version of Paket for the repository, so that everyone and every build server uses the same one. In the root of the repository:
|
Don't forget to commit .config/dotnet-tools.json to your source control. After a clone, run
dotnet tool restore to install the tools it lists, then run Paket with:
|
Global tool
A global tool puts the paket command on your PATH, for every repository of your machine:
|
You can also install Paket into a folder of the repository, and run it from there:
|
Paket.Restore.targets and paket.targets find Paket when it is installed with --tool-path in
.paket or in the root of the repository, as a local tool, or on the PATH, in that order.
Solutions without the .NET SDK
The projects that use the .NET SDK restore their packages through Paket.Restore.targets, which
paket install adds to them. For the other projects, such as the projects of a .NET Framework
solution built by Visual Studio, run:
|
It writes .paket/paket.targets and imports it into those projects, so that they run
paket restore before their build. Commit .paket/paket.targets as well. Paket can be a local
tool, a global tool or installed with --tool-path: paket.targets finds it the same way.
Moving from paket.exe and the bootstrapper
From Paket 12.0, paket.exe and paket.bootstrapper.exe are no longer published. A bootstrapper
older than 11.0 downloads a paket.exe that only explains how to move on, and fails the build.
The bootstrapper of Paket 11 never goes past the 11.x releases.
To move to the .NET tool:
- Install Paket as a local tool in the root of the repository.
-
Delete
.paket/paket.exe,.paket/paket.exe.configand.paket/paket.bootstrapper.exe, and remove theversionline frompaket.dependenciesif there is one: only the bootstrapper read it. -
In your build scripts, run
dotnet tool restorebefore Paket, and replace.paket/paket.exewithdotnet paket(withoutmonoin front of it). -
If you use
paket auto-restore, rundotnet paket auto-restore onagain to update.paket/paket.targets.
To keep paket.exe for now, move to the bootstrapper of Paket 11, which stays on the latest 11.x:
-
Remove the
versionline frompaket.dependenciesif there is one: with it, the bootstrapper downloads exactly that version, and--selfthe bootstrapper of that version. - Run
.paket/paket.bootstrapper.exe --self.
If .paket/paket.exe is the bootstrapper itself (magic mode), replace it with the
bootstrapper of the latest release,
which is the one of Paket 11.
Post installation
Once the basic installation is complete it is often very useful to add some tools to your shell/IDE/Text Editor of choice.
For next steps check out the Getting Started section.
Paket