namespace Microsoft.FSharp
namespace Microsoft.FSharp.Core
namespace Microsoft
val id : x:'T -> 'T

Full name: Microsoft.FSharp.Core.Operators.id

Dependency Management done right!



Introduction to PAKET!



Márcio Azevedo

Back in the old days...

Lib folder

...and when NuGet showed up, it made referencing a breeze.

But then, there was a new problem...

NuGetHell

So, what's the solution!?

PAKET

Dependency Manager for .NET (and Mono)

PAKET

designed to work well with NuGet packages and also enables referencing files directly from Git repositories or any HTTP resource.

It enables precise and predictable control over what packages the projects within your application reference.

Known problems

NuGet (the command tool) has no concept of transitive dependencies

NuGet puts the package version in the path

Updates may require manual work (specially if you update framework)

NuGet

How PAKET does it?

PAKET

Paket fully supports Semantic Versioning, and, currently, NuGet doesn’t (NuGet currently only supports SemVer 1.0.0).

NuGet does not support SemVer-compatible (v2.0.0) prerelease numbers with dot notation, as in 1.0.1-build.23. You can use a form like 1.0.1-build23 but this is always considered a pre-release version.

in PreRelease Semantic Versioning

Plan to implement SemVer 2.0.0 support

PAKET is composed by paket.bootstrapper.exe

  • Don't need to commit paket.exe to your repository
  • Bootstrapper is available for download - Bootstrapper
  • Bootstrapper allows to download latest paket.exe
  • Can be used for CI build or from inside Visual Studio

Bootstrapper

Paket.exe (.paket directory in root)

1: 
$ .paket\paket.exe --help

PAKET Commands

Global definition of dependencies

paket.dependencies (in solution root)

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json

// Reference a nuget package
nuget FSharp.Management
// Reference a single file from GitHub
github myRepo/aProject dependency.dll
github forki/FsUnit FsUnit.fs
File:FsUnit.fs

// Shared dependencies
nuget Newtonsoft.Json
nuget FSharp.Core

group Web
    nuget Fake.IIS
    nuget Suave

group Database
    nuget FluentMigrator
    nuget SQLProvider

List of used versions for all dependencies

paket.lock (generated from paket install)

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
NUGET
  remote: https://api.nuget.org/v3/index.json
    Microsoft.Bcl (1.1.9) - framework: >= net45
      Microsoft.Bcl.Build (>= 1.0.14)
    Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: >= net45
    Microsoft.Net.Http (2.2.28) - framework: >= net45
      Microsoft.Bcl (>= 1.1.9)
      Microsoft.Bcl.Build (>= 1.0.14)
    NuGet.CommandLine (3.5)

Dependency definition per project ("replaces" packages.config)

paket.references (in each project folder)

1: 
2: 
Microsoft.Net.Http
Newtonsoft.Json

Package definition for new packages

paket.template replaces the need for .nuspec file

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
type file
id Test.Paket.Package
version 1.0
authors Márcio Azevedo
description
    description of this test package
files
    src/Test.Paket.Package/bin/Debug ==> lib

Detailed options

PAKET

Some References

  • ElasticSearch.NET uses this in their .NET tools and libraries
  • Jet.com (e-commerce platform recently acquired by Walmart by 3bn $)

DEMO

PAKET

Gists

RECAP

  • Plain text over Command line tool
  • Direct vs. transitive dependencies
  • Only one version of a package

There's also a VS extension - Paket.VisualStudio

Q&A

Paket - Project Principles:

  • Integrate well into the existing NuGet ecosystem
  • Make things work with minimal tooling (plain text files)
  • Make it work on all platforms
  • Automate everything
  • Create a nice community

Thank you!