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.
2. Who are we? Maarten Balliauw Antwerp, Belgium www.realdolmen.com Focus on web ASP.NET, ASP.NET MVC, PHP, Azure, … MVP Windows Azure (formerly ASP.NET) http://blog.maartenballiauw.be @maartenballiauw
3. Who are we? Xavier Decoster Antwerp, Belgium www.realdolmen.com Focus on web/ALM Visual Studio, TFS, Scrum, ... Silverlight, ASP.NET, ASP.NET MVC, … http://www.xavierdecoster.com @xavierdecoster
4. Agenda Chickens? NuGet Scenarios Host your own NuGet repository Continuous (Package) Integration (Ab)usingNuGet Conclusion
6. WelcometoDependency Hell “A term for the frustrationof software users who have installedsoftware packageswhich have dependencieson specificversionsof other software packages.” Source: Wikipedia
7. Causeand Effect Reinventing the wheel We don’tneedthatdependency “If they can do it, we can do it, but better” Marketing does the versioning People are waitingfor v2 tobuy Let’s call it v4 Platform Update SP3 November Edition KB2348063 RTW Refresh Whathappenedtoreuse of components? We lost ownership of AssemblyVersion ?
9. Package Management NuGet to the Rescue! “NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio.”
10. Package What? Package Management Simple concept Find Packages (Re)Use Packages Produce Packages “…a collection of software tools to automate the process of installing, upgrading, configuring, and removingsoftware packages…” Wikipedia
19. Semantic Versioning Think about your versioning! (semver.org) Always specifylowerbound Use a version range (lowerbound + upperbound) whenversioning of package youdepend on is messed up
20. Advanced usage scenarios Host your own NuGet repository Continuous (Package) Integration (Ab)using NuGet
22. Hosting your own repository NuGet = public feed Privacy Intellectual property NuGet maintained by package authors Author removes v1.0.45 and you depend on it
25. NuGet.Serverlimitations Only 1 feed per installation No UI: up toyoutobuildit No granular security: only 1 API-keyforentire feed Conclusion: requiresyoutodevelopifyou want something more useful
26. Meet MyGet www.myget.org NaaS Register and off you go! (no dev) Supports Enterprise scenarios Granular security Package mirroring
29. Typical source control... Contains /References (if you are lucky) ...and also Project/_bin_deployable_assemblies ...and also /References/old ...and also /..././../.././References Usually references GAC-ed assemblies
30. Dependencies Software has dependencies. Deal with it. But are those YOUR intellectual property? YOUR reason to build software? YOUR product? No. They are dependencies. And they don’t belong in source control.
31.
32. 3rd partiesdon’tbelong in your SCM Source control bloatedwiththird-party binaries? Replacethem with NuGet packages Commitpackages.config/repositories.config files Preferablynot the packages Use NuGetPowerTools Enable-PackageRestore
33. Problem! NuGet feed is subject to change... PackageSourceMSBuild property to the rescue NuGet.settings.targets in $(SolutionDir)nuget folder Nowwhat... Host yourown feed andmirrorthird-party packages InternalNuGet.Server Network Share Or useMyGetforthat
36. Guidance Publishing a package bringsgreatresponsibility Breakingchanges in your packages shouldbeversionedaccordingly! Consumersmightchooseto no longerconsumeany packages youpublished
37. Guidance Package Integration ≠ Integration Testing CI buildsreflect output of source control input Same input alwaysproducessame output Do not auto-update packages duringautomatedbuilds!
38.
39. (Ab)using NuGet? Change of perspective NuGet as a package manager NuGet as a protocol for distributing packages
41. Scaffolding T4, Mvc, … CreateyourownPowerShellcmdlets Automate Visual Studio (access to DTE)
42. Automate deployments Build results in .nupkg Octopus deploys to its tentacles Test tentacles Staging tentacles Production tentacles www.octopusdeploy.com
43.
44. NuGet command line plug-ins Extend NuGet.exe Custom Commands How? Build class library Reference NuGet.exe Inherit Command Deploy your dll to %LocalAppData%uGetommands
45. Chocolatey NuGet developer library packages Chocolatey applications and tools packager “yum” or “apt-get” for Windows www.chocolatey.org
50. Thank you! Any questions? http://blog.maartenballiauw.be @maartenballiauw http://www.xavierdecoster.com @xavierdecoster
Notes de l'éditeur
Maarten
Maarten
Xavier
Xavier
Xavier
XavierMaarten
Maarten
NuGet Install-PackageWhen you use NuGet to install a package, it copies the library files to your solution and automatically updates your project (add references, change config files, etc). NuGet Uninstall-PackageIf you remove a package, NuGet reverses whatever changes it made so that no clutter is left.
Xavier: Terugverwijzen naar “Marketing versioning”
Xavier
Maarten
Maarten
Maarten
XavierStart with empty MVC template + addNuGet.ServerpkgRun siteDrop pkgs in packages folderRefresh browserFeed toevoegen in VS & show pkgs
Xavier
Maarten
MaartenInloggen en feed aanmakenPackage pushen vanuit NPEFeed toevoegen aan VSOp MyGet feed security instellenPackage installen in VS en tonen dat er basic auth bijkomtPackage vanNuGet toevoegen op MyGet en tonen dat je alle dependencies kan meepakken, mirroring, … en dat je ook gewoon van uw packages.config kan toevoegen
Xavier
Xavier
Xavier
Maarten
Maarten
Xavier- Het feit dat NuGet.org geen garanties biedt op content- Wat als mensen packages verwijderen? BUILD breaks, DEVS unhappy again
Maarten -> Xavier
Xavier
Xavier
Xavier
Maarten
Maarten
TODO Scaffolding? Toevoegen van functies?Eventueel de NuGet.exe plugins ook nog tonen?