20111010 agile minds - organize your chickens - nuget for the enterprise

51
1/25/22 | SLIDE 1 ORGANIZE YOUR CHICKENS NuGet for the Enterprise

Upload: xavier-decoster

Post on 10-May-2015

628 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 1

ORGANIZE YOUR CHICKENSNuGet for the Enterprise

Page 2: 20111010 agile minds - organize your chickens - nuget 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

Page 3: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 4: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 4

AGENDA

Chickens? NuGet Scenarios

Host your own NuGet repository Continuous (Package) Integration (Ab)using NuGet

Conclusion

Page 5: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 5

WELCOME TO DLL HELLDependency Hell

Page 6: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 7: 20111010 agile minds - organize your chickens - nuget for the enterprise

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 ?

Page 8: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 8

PACKAGE MANAGEMENTUsing NuGet

Page 9: 20111010 agile minds - organize your chickens - nuget for the enterprise

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.”

Page 10: 20111010 agile minds - organize your chickens - nuget for the enterprise

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…”

Source: Wikipedia

Page 11: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 12: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 12

CONSUMING PACKAGES

Simple as adding a reference

Page 13: 20111010 agile minds - organize your chickens - nuget for the enterprise

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…

Page 14: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 14

NUGET PACKAGE MANAGER CONSOLE

PowerShell enabled!

Extensible! Scaffolding, NuGetPowerTools, … %UserProfile%\Documents\WindowsPowerShell\NuGet_profile.ps1

Page 15: 20111010 agile minds - organize your chickens - nuget for the enterprise

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)

Page 16: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 17: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 18: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 18

NUGET MANIFEST SPECIFICATION

NuSpec manifest XML file (with XSD available) Package metadata

Page 19: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 20: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 20

ADVANCED USAGE SCENARIOS

Host your own NuGet repository Continuous (Package) Integration (Ab)using NuGet

Page 21: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 21

HOSTING YOUR OWN REPOSITORY

Those chickens are mine!

Page 22: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 23: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 23

SOLUTIONS

Folder / File share Orchard Gallery (or NuGet Gallery) NuGet.Server package MyGet

Page 24: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 24

NUGET.SERVER DEMOInstall-Package NuGet.Server

Page 25: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 26: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 27: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 27

MYGET DEMOLog in to www.myget.org and get started

Page 28: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 28

CONTINUOUS (PACKAGE) INTEGRATION

Fetch the chickens when you need them

Page 29: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 30: 20111010 agile minds - organize your chickens - nuget for the enterprise

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.

Page 31: 20111010 agile minds - organize your chickens - nuget for the enterprise

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!

Page 32: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 32

NUGETPOWERTOOLS DEMOOrganize your build chickens!

Page 33: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 34: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 35: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 36: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 36

(AB)USING NUGET

Page 37: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 38: 20111010 agile minds - organize your chickens - nuget for the enterprise

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!

Page 39: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 39

Page 40: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 40

(AB)USING NUGET?

Change of perspective

NuGet as a package manager

NuGet as a protocol for distributing packages

Page 41: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 41

EXTENDING NUGETScaffolding, CmdLets, Plug-ins, …

Page 42: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 42

SCAFFOLDING

T4, Mvc, … Create your own PowerShell cmdlets Automate Visual Studio (access to DTE)

Page 43: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 44: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 44

Page 45: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 46: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 46

CHOCOLATEY

NuGet developer library packages

Chocolatey applications and tools packager “yum” or “apt-get” for Windows

www.chocolatey.org

Page 47: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 47

CHOCOLATEY DEMONuGet desert

Page 48: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 49: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 49

CONCLUSION

Page 50: 20111010 agile minds - organize your chickens - nuget for the enterprise

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

Page 51: 20111010 agile minds - organize your chickens - nuget for the enterprise

APRIL 12, 2023 | SLIDE 51

THANK YOU!Any questions?

http://blog.maartenballiauw.be @maartenballiauw

http://www.xavierdecoster.com@xavierdecoster