Upload
maarten-balliauw
View
4.606
Download
0
Tags:
Embed Size (px)
DESCRIPTION
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.
Citation preview
APRIL 12, 2023 | SLIDE 1
ORGANIZE YOUR CHICKENSNuGet for the Enterprise
APRIL 12, 2023 | SLIDE 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
APRIL 12, 2023 | SLIDE 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
APRIL 12, 2023 | SLIDE 4
AGENDA
Chickens? NuGet Scenarios
Host your own NuGet repository Continuous (Package) Integration (Ab)using NuGet
Conclusion
APRIL 12, 2023 | SLIDE 5
WELCOME TO DLL HELLDependency Hell
APRIL 12, 2023 | SLIDE 6
WELCOME TO DEPENDENCY HELL
“A term for the frustration of software users who have installed software packages which have dependencies on specific versions of other software packages.”
Source: Wikipedia
APRIL 12, 2023 | SLIDE 7
CAUSE AND EFFECT
Reinventing the wheel We don’t need that dependency “If they can do it, we can do it, but better”
Marketing does the versioning People are waiting for v2 to buy Let’s call it v4 Platform Update SP3 November Edition
KB2348063 RTW Refresh
What happened to reuse of components?
We lost ownership of AssemblyVersion ?
APRIL 12, 2023 | SLIDE 8
PACKAGE MANAGEMENTUsing NuGet
APRIL 12, 2023 | SLIDE 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.”
APRIL 12, 2023 | SLIDE 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 removing software packages…”
Wikipedia
APRIL 12, 2023 | SLIDE 11
GETTING STARTED
Tooling: NuGet Package Manager (http://nuget.org) NuGet Package Explorer (http://npe.codeplex.com) Install-Package NuGetPowerTools Install-Package NuGet.CommandLine
Guidance and documentation http://docs.nuget.org
APRIL 12, 2023 | SLIDE 12
CONSUMING PACKAGES
Simple as adding a reference
APRIL 12, 2023 | SLIDE 13
ONE DIALOG TO RULE THEM ALL…
Install-Package Update-Package Uninstall-Package
Settings Package Sources Local (offline) Cache location
Also: Manage packages on solution level! Right-click solution > Manage NuGet Packages…
APRIL 12, 2023 | SLIDE 14
NUGET PACKAGE MANAGER CONSOLE
PowerShell enabled!
Extensible! Scaffolding, NuGetPowerTools, … %UserProfile%\Documents\WindowsPowerShell\NuGet_profile.ps1
APRIL 12, 2023 | SLIDE 15
CONFIGURABLE PACKAGE SOURCES
Configurable through… NuGet Library Package Manager (VS add-in)
NuGet.config (in %APPDATA%\Roaming\NuGet\NuGet.config) NuGet.settings.targets (MSBUILD file part of NuGetPowerTools)
APRIL 12, 2023 | SLIDE 16
CREATING PACKAGES
What’s a package? Just a zip-file containing: … content and source code (to be injected into target project) … PowerShell scripts and executables … configuration file and source code transformations
http://docs.nuget.org/docs/creating-packages/Configuration-File-and-Source-Code-Transformations
APRIL 12, 2023 | SLIDE 17
PACKAGE CONVENTIONS
Conventions http://
docs.nuget.org/docs/creating-packages/Package-Conventions
Folder structure Tools (init.ps1, install.ps1, uninstall.ps1) Content Manifest (.nuspec file) Lib
APRIL 12, 2023 | SLIDE 18
NUGET MANIFEST SPECIFICATION
NuSpec manifest XML file (with XSD available) Package metadata
APRIL 12, 2023 | SLIDE 19
SEMANTIC VERSIONING
Think about your versioning! (semver.org)
Always specify lowerbound Use a version range (lowerbound + upperbound) when
versioning of package you depend on is messed up
Major Breaking changes
Minor Backwards compatible API additions/changes
Patch Bugfixes not affecting the API
APRIL 12, 2023 | SLIDE 20
ADVANCED USAGE SCENARIOS
Host your own NuGet repository Continuous (Package) Integration (Ab)using NuGet
APRIL 12, 2023 | SLIDE 21
HOSTING YOUR OWN REPOSITORY
Those chickens are mine!
APRIL 12, 2023 | SLIDE 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
APRIL 12, 2023 | SLIDE 23
SOLUTIONS
Folder / File share Orchard Gallery (or NuGet Gallery) NuGet.Server package MyGet
APRIL 12, 2023 | SLIDE 24
NUGET.SERVER DEMOInstall-Package NuGet.Server
APRIL 12, 2023 | SLIDE 25
NUGET.SERVER LIMITATIONS
Only 1 feed per installation No UI: up to you to build it No granular security: only 1 API-key for entire feed Conclusion: requires you to develop if you want
something more useful
APRIL 12, 2023 | SLIDE 26
MEET MYGET
www.myget.org NaaS
Register and off you go! (no dev)
Supports Enterprise scenarios Granular security Package mirroring
APRIL 12, 2023 | SLIDE 27
MYGET DEMOLog in to www.myget.org and get started
APRIL 12, 2023 | SLIDE 28
CONTINUOUS (PACKAGE) INTEGRATION
Fetch the chickens when you need them
APRIL 12, 2023 | SLIDE 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
APRIL 12, 2023 | SLIDE 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.
APRIL 12, 2023 | SLIDE 31
CONTINUOUS (PACKAGE) INTEGRATION
Can I get rid of all these referenced assemblies duplicated all-over my source control system?Yes!
Do I need to install and maintain NuGet on all my build agents?No!
APRIL 12, 2023 | SLIDE 32
NUGETPOWERTOOLS DEMOOrganize your build chickens!
APRIL 12, 2023 | SLIDE 33
3RD PARTIES DON’T BELONG IN YOUR SCM
Source control bloated with third-party binaries? Replace them with NuGet packages
Commit packages.config/repositories.config files Preferably not the packages
Use NuGetPowerTools Enable-PackageRestore
APRIL 12, 2023 | SLIDE 34
PROBLEM!
NuGet feed is subject to change... PackageSource MSBuild property to the rescue NuGet.settings.targets in $(SolutionDir)\.nuget folder
Now what... Host your own feed and mirror third-party packages
Internal NuGet.Server Network Share
Or use MyGet for that
APRIL 12, 2023 | SLIDE 35
ORGANIZE YOUR CHICKENS
Feed structuring Scoped by quality: Build, QA, Production, … Scoped by audience: public, restricted access Other:
Scoped by product version, milestone… Scoped by target platform
APRIL 12, 2023 | SLIDE 36
(AB)USING NUGET
APRIL 12, 2023 | SLIDE 37
GUIDANCE
Publishing a package brings great responsibility Breaking changes in your packages should be versioned
accordingly! Consumers might choose to no longer consume any packages
you published
APRIL 12, 2023 | SLIDE 38
GUIDANCE
Package Integration ≠ Integration Testing CI builds reflect output of source control input Same input always produces same output
Do not auto-update packages during automated builds!
APRIL 12, 2023 | SLIDE 39
APRIL 12, 2023 | SLIDE 40
(AB)USING NUGET?
Change of perspective
NuGet as a package manager
NuGet as a protocol for distributing packages
APRIL 12, 2023 | SLIDE 41
EXTENDING NUGETScaffolding, CmdLets, Plug-ins, …
APRIL 12, 2023 | SLIDE 42
SCAFFOLDING
T4, Mvc, … Create your own PowerShell cmdlets Automate Visual Studio (access to DTE)
APRIL 12, 2023 | SLIDE 43
AUTOMATE DEPLOYMENTS
Build results in .nupkg Octopus deploys to its tentacles
Test tentacles Staging tentacles Production tentacles
www.octopusdeploy.com
APRIL 12, 2023 | SLIDE 44
APRIL 12, 2023 | SLIDE 45
NUGET COMMAND LINE PLUG-INS
Extend NuGet.exe Custom Commands
How? Build class library Reference NuGet.exe Inherit Command Deploy your dll to %LocalAppData%\NuGet\Commands
APRIL 12, 2023 | SLIDE 46
CHOCOLATEY
NuGet developer library packages
Chocolatey applications and tools packager “yum” or “apt-get” for Windows
www.chocolatey.org
APRIL 12, 2023 | SLIDE 47
CHOCOLATEY DEMONuGet desert
APRIL 12, 2023 | SLIDE 48
ORCHARD / WEBMATRIX / …
NuGet not bound to VS Orchard CMS: modules & themes WebMatrix: install page helpers on the fly Your app: offer plugins through a repo
APRIL 12, 2023 | SLIDE 49
CONCLUSION
www.visug.be
• Dependencies & people are chickensDeal with them! NuGet can help
• Set up your own NuGet repository for various reasons
• Continuous package integration
• NuGet is a package managerNuGet is a protocol
Conclusion
APRIL 12, 2023 | SLIDE 51
THANK YOU!Any questions?
http://blog.maartenballiauw.be @maartenballiauw
http://www.xavierdecoster.com@xavierdecoster