paket.local file is used for testing changes before releasing new version of a dependent project.
Note: you shouldn't commit
paket.local. This file should always be added to
.gitignore, because it specifies file paths that are only accessible on your machine.
In this tutorial you will learn how
paket.local can help you to speed up your development process.
The Paket project uses Argu as one of its own dependencies. Argu is a library that allows to manage command line parameters:
1: 2: 3: 4:
paket restore, the Argu package is always restored from the NuGet source that was specified in Paket's own
1: 2: 3: 4: 5:
Now let's assume that we want to contribute to Paket by adding a new feature. The new feature, however, requires a change to Argu, so we'll need to contribute to the Argu project first.
Before we create a Pull Request to Argu, we might want to test the change locally by running Paket with the applied change in the Argu package.
Up until now, there was no convenient mechanism to do so, and e.g. we would manually copy updated Argu libraries to the packages folder in Paket's project after each rebuild.
paket.local file, we can improve this process, by temporarily overriding the source for a specific package. We create a
paket.local file in the root of own Paket source code copy:
The line above basically says: whenever
paket restore is run, override the source of the Argu package with the source given after
Now when running
paket restore, we get the following:
1: 2: 3: 4: 5: 6: 7:
As a result:
- the build command
build.cmd NuGetis triggered for Argu on
- a new Argu NuGet package is built by this command in the
- the Argu NuGet package is extracted to
packages/Argudirectory in the Paket project folder
- Paket can be run and tested with the updated Argu library
Note: Any override specified in
paket.localwill result in a warning upon running
restoreas in the above example. This is to emphasize that we have a local override, and the build might not be reproducible on any other machine.
Each line in
paket.local means one override - you can have multiple overrides at once:
Format of git source is the same as used in
paket.dependencies for specifying git repositories.
Note: only git repositories as NuGet source (with
Packages: ...) are currently supported
1: 2: 3: 4:
The Format of the source is the same as in path sources.
Note: In case of source override,
paket restoreassumes the NuGet package already exists in pointed directory - no build is going to be triggered.
If you happen to have a nupkg in local path, but with a different version than in
paket.lock, you can optionally specify version which should be used for this override.
One use case might be when the package version is determined by your build server, and nupkgs created locally have zero version.
This is currently supported only for Source override.
1: 2: 3: 4:
The dependency group can be specified with
group <GroupName> after
If not specified, the default group ("Main") is used.
All lines starting with with
# are considered comments.
Comments might prove helpful if you use
paket.local override on regular basis - instead of typing the override by hand, you can just comment/uncomment relevant line: