Transcript
Page 1: Controlling Component Chaos with NuGet and Versioning

Controlling

Component Chaos

with NuGet and

Versioningby John Williston Perforce Software

Page 2: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

John WillistonPerforce Software

Page 3: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• NuGet overview

• Consuming components

• Producing components

• Gotchas and Q&A

Agenda

Page 4: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

NuGet Overview

Page 5: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• YAPM: Yet Another Package Manager

• Packages are zip archives

• Originally .NET, now anything

• Discovery, packages, dependencies, updates

What is NuGet?

Page 6: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Web site/service describes packages

• NuGet.exe and VisualStudio extension:

– Makes packages from specs

– Pulls packages by ID and version

– Pushes packages to publish

How Does It Work?

Page 7: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Nuget.org web site

NuGet package feed(AtomPub)

NuGet.exe Tool

NuGet Extension

NuGet Diagram

Page 8: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Consuming Components

Page 9: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Main NuGet Web Site

Page 10: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Package Details

Page 11: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Managing Packages in a Solution

Page 12: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Adds new build targets

• Pulls and unzips packages

• Creates/updates configuration files

• Hooks up dependencies

• Runs installer scripts (if any)

How Does It Work?

Page 13: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• How does NuGet track what I’m using?

• How do others get the same packages?

• Do I need to add it to my build process?

Some Obvious Questions

Page 14: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

NuGet Folders and Files

Page 15: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Packages.config Contents

Page 16: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• All packages.config files

• The .nuget folder contents

• Nothing else needs to be versioned

What Do I Version?

Page 17: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Pulls by semantic version

• Update process prefers latest

• Default strategy updates dependencies too

• Update must be used carefully

Component Versions

Page 18: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Prefer implicit checkout

• Reconcile before and after

• P4 ignore is your friend

• Be sure to use P4VS

• Isolate big NuGet operations

Perforce Tips

Page 19: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Implicit Checkout Means +Allwrite

Page 20: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Problems installing/updating

• Mark as edit ahead of time

• Seek masochist support group

But I Prefer Explicit Checkout!

Page 21: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Clean to catch old references

• Different feeds for different builds

• Automate third-party package audits

• Scripting catches multiple versions

DevOps Considerations

Page 22: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Producing Components

Page 23: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Privacy requires your own NuGet server

• Organizational shift in thinking

• Good naming conventions early

• Understand semantic versioning

Some Assembly Required

Page 24: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• How do I make my own packages?

• Where do I put them?

• And how do I put them there?

Some Obvious Questions

Page 25: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• The *.nuspec file

– Useful metadata

– Content and layout

– Other package dependencies

• NuGet tool creates package

• Push with a new version number

Building a Package

Page 26: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Understand semantic versioning

• Develop components in isolation

• Careful interface design and versioning

• Unit test at least every public method

• Document all public symbols

Development Best Practices

Page 27: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Automate push on release and documentation

• Automate labelling for traceability

• Source/symbol serving is your friend

• Version all the things! (if you wish)

DevOps Considerations

Page 28: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

Gotchas and Q&A

Page 29: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

• Pre-configure Visual Studio

• Relative paths for source server

• NuGet extension problem with P4VS

• Update versioning strategy

• Soft dependencies can hurt

Common Gotchas

Page 30: Controlling Component Chaos with NuGet and Versioning

Controlling Component Chaos with NuGet and Versioning

THANK YOU!!!

John Williston, Ph.D

[email protected]

@p4jbw

P4Ideax Forums


Top Related