Upgrade to Pro — share decks privately, control downloads, hide ads and more …

.NET Dependency Management with Paket

.NET Dependency Management with Paket

70th Lisbon .NET Community Session

Pedro Felix

June 24, 2017
Tweet

More Decks by Pedro Felix

Other Decks in Programming

Transcript

  1. .NET Dependency Management with Paket Pedro Félix @pmhsfelix Lisbon, June

    24, 2017 70ª Reunião Presencial da Comunidade NetPonto em Lisboa
  2. whoami • Professor at the Lisbon Polytechnic Institute – ISEL

    • Principal Software Engineer role at Sky • Concurrent programming, HTTP APIs, Identity and Access Management • Designing Evolvable Web APIs with ASP.NET, O’Reilly, 2014 See http://webapibook.net/ - freely available in HTML format
  3. Motivation • Large .NET solution • Multiple deployable projects (HTTP

    APIs, services, tools) • > 3 years old • Constantly changing dependencies
  4. Motivation • Versioning conflicts • Large commit diff. when a

    dependency changes • Lack of predictability • Lack of visibility • Runtime issues • Slowness • “Death by a thousand cuts”
  5. Alternatives • Paket - https://fsprojects.github.io/Paket/ • Open Source • F#

    • A full replacement for NuGet? • How does it relates to NuGet? • What are the improvements? • Visual Studio integration?
  6. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj NugGet Server (name, version, deps) package
  7. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj nuget NuGet Server (name, version, deps) package query & fetch protocol
  8. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj nuget NuGet Server (name, version, deps) package query & fetch protocol
  9. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj nuget NuGet Server (name, version, deps) package query & fetch protocol  not in source control
  10. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj nuget NuGet Server (name, version, deps) package query & fetch protocol packages .config  in source control  not in source control
  11. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj nuget NuGet Server (name, version, deps) package query & fetch protocol packages .config per project  in source control  not in source control restore info per-project flat
  12. NuGet problems • packages.config is per project • Different versions

    for the same dependency on the same solution • packages.config is flat • Was a dependency directly or indirectly required? • Why was that version required? • No global view of the dependencies • Package/lib folder contains version number • Potential merge conflict on all .csproj and packages.config • Need to change any script that references the package/lib
  13. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj nuget NuGet Server (name, version, deps) package query & fetch protocol packages .config per project  in source control  not in source control restore info per-project flat
  14. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj paket NuGet Server (name, version, deps) package query & fetch protocol per project  not in source control paket .dependencies root deps version criteria per solution
  15. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj paket NuGet Server (name, version, deps) package query & fetch protocol per project  not in source control paket .dependencies root deps version criteria per solution paket .references per project
  16. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj paket NuGet Server (name, version, deps) package query & fetch protocol per project  not in source control paket .dependencies root deps version criteria per solution paket .references per project paket .lock dependency graph paket generated
  17. (name, version, deps) package (name, version, deps) package (name, version,

    deps) package (name, version, deps) package Dependency Management assembly (name, version, deps) .csproj paket NuGet Server (name, version, deps) package query & fetch protocol per project  not in source control paket .dependencies root deps version criteria per solution paket .references per project paket .lock dependency graph paket generated  source control  source control  source control
  18. paket • paket.dependencies – solution scope • Simple text format

    • Dependency sources • Dependencies and their version criteria • paket.references – project scope • Simple text format • References the used dependencies by name • paket.lock – solution scope • Simple text format • Generated by paket with the complete dependency graph • Source for the restore process
  19. Final remarks • Commands • install, restore, ... • Binding

    redirect management • Simple text formats • paket.lock • Restore determinism • Dependency visibility
  20. Final remarks • Supports multiple Nuget servers • Other sources

    other than NuGet: HTTP and GitHub • Embrace the command line and simple text formats • Emphasis on dependency management • And just not simply downloading and referencing • Global view of the dependencies • Version control friendly • Less file changes • More informative changes
  21. Q&A

  22. Próximas reuniões presenciais 26/06/2017 – Lisboa 01/07/2017 – Porto 29/07/2017

    – Lisboa 23/09/2017 – Lisboa 30/09/2017 – Leiria Reserva estes dias na agenda! :)