Git dependencies
Paket allows you to automatically manage the linking of files from any Git repository.
This feature assumes that you have git installed. If you don't have git installed then Paket still allows you to reference files from GitHub.
Referencing a Git repository
You can reference a complete Git repository by specifying the clone URL in the
paket.dependencies
file:
1: 2: |
|
This will clone the repository, checkout the latest version of the default
branch and put it into your paket-files
directory.
If you want to restrict Paket to a special branch, tag or a concrete commit then this is also possible:
1: 2: 3: 4: 5: |
|
Referencing Git tags
Paket allows you to specify version ranges for Git tags similar to NuGet version ranges:
1: 2: 3: 4: 5: 6: |
|
You can read more about the version range details in the corresponding NuGet reference section.
Running a build in Git repositories
If your referenced Git repository contains a build script then Paket can execute this script after restore:
1: 2: |
|
This allows you to execute arbitrary commands after restore.
NOTE: This functionality uses the .NET Process
API, with UseShellExecute
set
to true
. This means that on Windows your command will execute in a cmd.exe
context. If your build is not a .bat
file, you will need to fully qualify the
command with the shell program to run as well, like this:
1:
|
|
Using Git repositories as NuGet source
With pre-built, checked-in nupgks
If you have NuGet packages inside a git repository you can easily use the
repository as a NuGet source from the paket.dependencies
file:
1: 2: 3: |
|
The generated paket.lock
file will look like this:
1: 2: 3: 4: 5: 6: |
|
Building nupkg on install
It's also possible to run build scripts to create the NuGet packages when installing/restoring with paket:
1: 2: 3: |
|
NOTE: this assumes that the name of the package is Argu
which can't be inferred in this case since no *.fsproj
or .sln
file is present in the example repository
Arbitrary build scripts
1: 2: 3: 4: |
|
In this sample we have different build scripts for Mono and Windows. Both of the specified scripts simply copy the prebuilt nupkgs from /bin
to /source
Actually using the package
Don't forget to also add your dependency to the paket.references
file.