Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Organize your chickens: NuGet for the enterprise


Published on

Managing software dependencies, whether those created in-house or from third parties can be a pain in the behind. Whether dependencies feel like wild chickens or people run around like chickens dealing with dependencies, the NuGet package manager can be a cure. Let us guide you to creating enterprise (chicken) NuGets and dealing with them in a structured, easy-to-maintain manner. From developer workstation to build server, NuGet tastes great! We'll provide you the dip sauce.

Published in: Technology
  • Be the first to comment

Organize your chickens: NuGet for the enterprise

  1. 1. Organize your chickens<br />NuGet for the Enterprise<br />
  2. 2. Who are we?<br />Maarten Balliauw<br />Antwerp, Belgium<br /><br />Focus on web<br />ASP.NET, ASP.NET MVC, PHP, Azure, …<br />MVP Windows Azure (formerly ASP.NET)<br /><br />@maartenballiauw<br />
  3. 3. Who are we?<br />Xavier Decoster<br />Antwerp, Belgium<br /><br />Focus on web/ALM<br />Visual Studio, TFS, Scrum, ...<br />Silverlight, ASP.NET, ASP.NET MVC, …<br /><br />@xavierdecoster<br />
  4. 4. Agenda<br />Chickens?<br />NuGet<br />Scenarios<br />Host your own NuGet repository<br />Continuous (Package) Integration<br />(Ab)usingNuGet<br />Conclusion<br />
  5. 5. Welcome to Dll Hell<br />Dependency Hell<br />
  6. 6. WelcometoDependency Hell<br />“A term for the frustrationof software users who have installedsoftware packageswhich have dependencieson specificversionsof other software packages.”<br />Source: Wikipedia<br />
  7. 7. Causeand Effect<br />Reinventing the wheel<br />We don’tneedthatdependency<br />“If they can do it, we can do it, but better”<br />Marketing does the versioning<br />People are waitingfor v2 tobuy<br />Let’s call it v4 Platform Update SP3 November Edition KB2348063 RTW Refresh<br /> Whathappenedtoreuse of components?<br /> We lost ownership of AssemblyVersion ?<br />
  8. 8. Package Management<br />Using NuGet<br />
  9. 9. Package Management<br />NuGet to the Rescue!<br />“NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio.”<br />
  10. 10. Package What?<br />Package Management<br />Simple concept<br />Find Packages<br />(Re)Use Packages<br />Produce Packages<br />“…a collection of software tools to automate the process of installing, upgrading, configuring, and removingsoftware packages…”<br />Wikipedia<br />
  11. 11. GettingStarted<br />Tooling:<br />NuGet Package Manager (<br />NuGet Package Explorer (<br />Install-Package NuGetPowerTools<br />Install-Package NuGet.CommandLine<br />Guidanceanddocumentation<br /><br />
  12. 12. Consuming Packages<br />Simple as adding a reference<br />
  13. 13. Onedialogtorulethemall…<br />Install-Package<br />Update-Package<br />Uninstall-Package<br />Settings<br />Package Sources<br />Local (offline) Cache location<br />Also: Manage packages on solution level!<br />Right-click solution > Manage NuGet Packages…<br />
  14. 14. NuGet Package Manager Console<br />PowerShellenabled!<br />Extensible!<br />Scaffolding, NuGetPowerTools, …<br />%UserProfile%DocumentsWindowsPowerShellNuGet_profile.ps1<br />
  15. 15. Configurable Package Sources<br />Configurablethrough…<br />NuGet Library Package Manager (VS add-in)<br />NuGet.config (in %APPDATA%RoamingNuGetNuGet.config)<br />NuGet.settings.targets (MSBUILD file part of NuGetPowerTools)<br />
  16. 16. Creating Packages<br />What’s a package?<br />Just a zip-filecontaining:<br />… content and source code (tobeinjectedinto target project)<br />… PowerShell scripts andexecutables<br />… configuration file and source code transformations<br /><br />
  17. 17. Package Conventions<br />Conventions<br /><br />Folder structure<br />Tools (init.ps1, install.ps1, uninstall.ps1)<br />Content<br />Manifest (.nuspec file)<br />Lib<br />
  18. 18. NuGet Manifest Specification<br />NuSpec manifest<br />XML file (with XSD available)<br />Package metadata<br />
  19. 19. Semantic Versioning<br />Think about your versioning! (<br />Always specifylowerbound<br />Use a version range (lowerbound + upperbound) whenversioning of package youdepend on is messed up<br />
  20. 20. Advanced usage scenarios<br />Host your own NuGet repository<br />Continuous (Package) Integration<br />(Ab)using NuGet<br />
  21. 21. Hosting your own repository<br />Those chickens are mine!<br />
  22. 22. Hosting your own repository<br />NuGet = public feed<br />Privacy<br />Intellectual property<br />NuGet maintained by package authors<br />Author removes v1.0.45 and you depend on it<br />
  23. 23. Solutions<br />Folder / File share<br />Orchard Gallery (or NuGet Gallery)<br />NuGet.Server package<br />MyGet<br />
  24. 24. NuGet.Server Demo<br />Install-Package NuGet.Server<br />
  25. 25. NuGet.Serverlimitations<br />Only 1 feed per installation<br />No UI: up toyoutobuildit<br />No granular security: only 1 API-keyforentire feed<br />Conclusion: requiresyoutodevelopifyou want something more useful<br />
  26. 26. Meet MyGet<br /><br />NaaS<br />Register and off you go! (no dev)<br />Supports Enterprise scenarios<br />Granular security<br />Package mirroring<br />
  27. 27. MyGet Demo<br />Log in to and get started<br />
  28. 28. Continuous (Package) Integration<br />Fetch the chickens when you need them<br />
  29. 29. Typical source control...<br />Contains /References (if you are lucky)<br />...and also Project/_bin_deployable_assemblies<br />...and also /References/old<br />...and also /..././../.././References<br />Usually references GAC-ed assemblies<br />
  30. 30. Dependencies<br />Software has dependencies. Deal with it.<br />But are those YOUR intellectual property?<br />YOUR reason to build software?<br />YOUR product?<br />No. They are dependencies. And they don’t belong in source control.<br />
  31. 31. Continuous (Package) Integration<br />Can I get rid of all these referencedassembliesduplicatedall-over my source control system?<br /><ul><li>Yes!</li></ul>Do I needtoinstallandmaintainNuGet on allmybuildagents?<br /><ul><li>No!</li></li></ul><li>NuGetPowerTools Demo<br />Organize your build chickens!<br />
  32. 32. 3rd partiesdon’tbelong in your SCM<br />Source control bloatedwiththird-party binaries?<br />Replacethem with NuGet packages<br />Commitpackages.config/repositories.config files<br />Preferablynot the packages<br />Use NuGetPowerTools<br />Enable-PackageRestore<br />
  33. 33. Problem!<br />NuGet feed is subject to change...<br />PackageSourceMSBuild property to the rescue<br />NuGet.settings.targets in $(SolutionDir).nuget folder<br />Nowwhat...<br />Host yourown feed andmirrorthird-party packages<br />InternalNuGet.Server<br />Network Share<br />Or useMyGetforthat<br />
  34. 34. Organizeyourchickens<br />Feed structuring<br />Scopedbyquality: Build, QA, Production, …<br />Scopedbyaudience: public, restricted access<br />Other: <br />Scopedby product version, milestone…<br />Scopedby target platform<br />
  35. 35. (Ab)using NuGet<br />
  36. 36. Guidance<br />Publishing a package bringsgreatresponsibility<br />Breakingchanges in your packages shouldbeversionedaccordingly!<br />Consumersmightchooseto no longerconsumeany packages youpublished<br />
  37. 37. Guidance<br />Package Integration ≠ Integration Testing<br />CI buildsreflect output of source control input<br />Same input alwaysproducessame output<br />Do not auto-update packages duringautomatedbuilds!<br />
  38. 38.
  39. 39. (Ab)using NuGet?<br />Change of perspective<br />NuGet as a package manager<br />NuGet as a protocol for distributing packages<br />
  40. 40. ExtendingNuGet<br />Scaffolding, CmdLets, Plug-ins, …<br />
  41. 41. Scaffolding<br />T4, Mvc, …<br />CreateyourownPowerShellcmdlets<br />Automate Visual Studio (access to DTE)<br />
  42. 42. Automate deployments<br />Build results in .nupkg<br />Octopus deploys to its tentacles<br />Test tentacles<br />Staging tentacles<br />Production tentacles<br /><br />
  43. 43.
  44. 44. NuGet command line plug-ins<br />Extend NuGet.exe<br />Custom Commands<br />How?<br />Build class library<br />Reference NuGet.exe<br />Inherit Command<br />Deploy your dll to %LocalAppData%NuGetCommands<br />
  45. 45. Chocolatey<br />NuGet<br />developer library packages<br />Chocolatey<br />applications and tools packager<br />“yum” or “apt-get” for Windows<br /><br />
  46. 46. Chocolatey Demo<br />NuGet desert<br />
  47. 47. Orchard / WebMatrix / …<br />NuGetnotboundto VS<br />Orchard CMS: modules & themes<br />WebMatrix: install page helpers on the fly<br />Yourapp: offer pluginsthrough a repo<br />
  48. 48. Conclusion<br />
  49. 49. Dependencies & people are chickens<br /><ul><li>Deal with them! NuGet can help</li></ul>Set up your own NuGet repository for various reasons<br />Continuous package integration<br />NuGet is a package manager<br /><ul><li>NuGet is a protocol</li></ul>Conclusion<br />
  50. 50. Thank you!<br />Any questions?<br /> <br />@maartenballiauw <br /><br />@xavierdecoster<br />