SlideShare a Scribd company logo
Using NuGet the way you should - TechDays NL 2014
Laat ons weten wat u vindt van deze sessie! Vul de evaluatie
in via www.techdaysapp.nl en maak kans op een van de 20
prijzen*. Prijswinnaars worden bekend gemaakt via Twitter
(#TechDaysNL). Gebruik hiervoor de code op uw badge.
Let us know how you feel about this session! Give your
feedback via www.techdaysapp.nl and possibly win one of
the 20 prizes*. Winners will be announced via Twitter
(#TechDaysNL). Use your personal code on your badge.
* Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are
examples
Using NuGet
the way you should
Maarten Balliauw
@maartenballiauw
Who am I?
• Maarten Balliauw
• Antwerp, Belgium
• Technical Evangelist, JetBrains
• Founder, MyGet
• AZUG
• Focus on web
• ASP.NET MVC, Azure, SignalR, ...
• MVP Azure & ASPInsider
• Big passion: Azure
• http://blog.maartenballiauw.be
• @maartenballiauw
Shameless self promotion: Pro NuGet -
http://amzn.to/pronuget2
Agenda
• NuGet
• File | New Project…
• The state of NuGet
• Every project is a package
• Creating packages
• Distributing packages
• Consuming packages
NuGet
A brief NuGet introduction...
• Package management system for .NET
• Visual Studio extension, command line, console
• Simplifies incorporating 3rd party libraries
• Developer focused
• Free, open source
• Use packages from the official feed
• Publish your own packages
• Create & use your own feed
File | New
Project...
Demo
File | New Project...
That was trouble!
•Dependencies on NuGet packages
•Dependencies on projects
•Dependencies on file system layout
•Breaking changes in dependencies
Dependency hell
“Dependencies, also in
real life, are trouble.
Have you ever had to
depend on a plumber?”
- Maarten Balliauw
Dependencies before NuGet
•Projects in solution
•Reference in-house projects:
• Either the assemblies (typically unversioned / all 1.0.0.0)
• Either the actual project / linked files (unversioned by design)
•Reference third party assemblies (e.g.
JSON.NET)
Dependencies with NuGet
•Projects in solution
•Reference in-house projects:
• Either the assemblies (typically unversioned / all 1.0.0.0)
• Either the actual project / linked files (unversioned by design)
•Reference third party packages (e.g. JSON.NET)
• Semantic Versioning to announce breaking changes
(happy times as long as package authors respect that)
The state of
NuGet
The state of NuGet
•We are consumers!
• Even quite some overconsumption I dare say…
•We sort of know about Semantic Versioning
• If the mayor version changes, we’re doomed
•Are we producing?
• Some are, e.g. OSS and some companies
•Did we solve our dependency issues?
Where are we, 3 years in?
.NET is late to the party!
•Others have been doing package management for
decades
• Perl (CPAN.org)
• Linux (RPM/YUM/APT-GET/...)
• PHP (PEAR, Composer)
• Node (npm)
• Ruby (Gems)
•We can learn a great deal from these!
What are the others doing?
{
"name" : "IniTech.Framework.Formatters",
"version" : "1.0.0 ",
"author" : "Maarten Balliauw",
"bugs" : { "url" : "https://github.com/initech/framework-formatters/issues" },
"description" : "Formatters specific to the IniTech organization.",
"homepage" : "https://github.com/initech/framework-formatters",
"keywords" : [ "framework", "formatters", "initech" ],
"license" : "Proprietary",
"main" : "index.js", "repository" : { "type" : "git",
"url" : "https://github.com/initech/framework-formatters"
},
"scripts" : { "test" : "echo "Error: no test specified" && exit 1" },
"dependencies" : {
"date-format" : "0.0.2",
"format" : "~0.2.1",
"moment" : "~2.5.1"
}
}
What are the others doing?
•Name and version of the project
•Dependencies (and version range) of the project
•Every project is a package!
• It can have dependencies
• It can be depended on
What was in that package.json?
Every project is a
package
Supporting componentization
•Every project is a package
• Clearly identifyable
• Proper Semantic Versioning
•Every project becomes discoverable
• Nice description, release notes, ...
• Add it to a private feed so developers can find it
•Dependencies (can) stay out of source control
•Dependencies are versioned
But… NuGet only has packages.config!
•Nodejs: packages.json
•Composer (PHP): composer.json
•NuGet:
• packages.config: dependencies
• <projectname>.nuspec: package description
• NuGet.config: other settings
• It’s 2-3 files in our world, but it is all there.
•Let’s become producers!
“Project references
must die.”
- Maarten Balliauw
Creating packages
All we need is one file
•XML file which can be generated
• nuget.exe spec
• Install-Package NuSpec && Install-Nuspec
•Run nuget.exe pack to create package
<projectname>.nuspec
Demo
Creating packages
Think about versioning!
• www.semver.org
• SemVer states intentions
• It’s the only way to
avoid dependency
versioning hell.
But not bullet-proof.
Enforce Explicit Semantic Versioning
Major Breaking changes
Minor Backwards compatible changes
e.g. API additions
Patch Bugfixes not affecting the API
<dependency id="ExamplePackage" version="1.3.2" />
1.0 = 1.0 ≤ x
(,1.0] = x ≤ 1.0
(,1.0) = x < 1.0
[1.0] = x == 1.0
(1.0) = invalid
(1.0,) = 1.0 < x
(1.0,2.0) = 1.0 < x < 2.0
[1.0,2.0] = 1.0 ≤ x ≤ 2.0
empty = latest version
Distributing packages
Which medium?
• In source control (please don’t)
• Local / network folder (slow > ~50 packages)
• NuGet.Server (slow > ~50 packages)
• NuGet Gallery (clone of www.nuget.org)
• MyGet (www.myget.org, SaaS)
• ProGet (www.inedo.com/proget)
• TeamCity NuGet artifacts
(www.jetbrains.com/teamcity)
We will need a “package source” or feed
How do they get there?
•Manual upload
•As part of our continuous integration process
• All benefits of CI (e.g. testing)
• Plus reporting on which packages we are using
• Plus publishing packages for consumption
Demo
Continuous Integration
& Distributing Packages with TeamCity
What did we just see?
•Creating packages using .nuspec
•NuGet configuration inheritance
•Continuous Integration on TeamCity
• How to run package restore
• How to build a package
• How to see packages that are being used
•How to consume a package
NuGet configuration inheritance
•Make settings common to projects!
• NuGet walks up the directory tree to find NuGet.config files
•Or even push them to developer machines
• %AppData%NuGetNuGet.config
• %ProgramData%NuGetConfig*.config
• ...
•See http://bit.ly/nuget-config-inheritance
•Configure feeds, proxy, credentials, ...
More recommendations…
•Don’t just update blindly
• Not everyone respects SemVer…
• It would take us back to the original problem
•Don’t autoupdate during builds
• Continuous Integration: Same Input = Same Output
• Be explicit about versioning
Deploying from NuGet packages
•Using a simple, handcrafted script
•Using a tool like OctopusDeploy.com
• Which is even cooler combined with Chocolatey.org
•TeamCity supports various ways of deploying
(e.g. WebDeploy)
Demo
Deploying packaged applications
with a handcrafted script
Considerations
•TeamCity internal NuGet feed
• Only build artifacts
• No way to add external packages that are being used
• May not be a problem for your setup
• But maybe it is: a feed is much like source control for dependencies
• Add dependencies that are being used, NuGet.org, component
vendors, ...
• If it is, create your own feed, e.g. MyGet.org
Create a package source / feed
•That’s a cool library! And that one too!
• Avoid overconsumption by limiting packages
• May not block developers but at least the build will fail
•Your own feed will only contain packages you
know
• Keep versions under control
• Keep licensing under control
• Easy way to audit external packages in use
For your team or the entire organization
Demo
Pushing packages from TeamCity
Conclusions
Conclusions
• NuGet
• File | New Project…
• The state of NuGet
• Every project is a package
• Creating packages
• Distributing packages
• Consuming packages
What have we learned?
“Stop just consuming
NuGet packages. Re-
think your development
by also creating them. It’s
a logical evolution.”
- Maarten Balliauw
Thank you!
http://blog.maartenballiauw.be
@maartenballiauw
http://amzn.to/pronuget
Laat ons weten wat u vindt van deze sessie! Vul de evaluatie
in via www.techdaysapp.nl en maak kans op een van de 20
prijzen*. Prijswinnaars worden bekend gemaakt via Twitter
(#TechDaysNL). Gebruik hiervoor de code op uw badge.
Let us know how you feel about this session! Give your
feedback via www.techdaysapp.nl and possibly win one of
the 20 prizes*. Winners will be announced via Twitter
(#TechDaysNL). Use your personal code on your badge.
* Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are
examples

More Related Content

What's hot (20)

PDF
Introduction to package manager
yashobantabai
 
PPTX
Using nu get the way you should svcc
Maarten Balliauw
 
PDF
Testing fácil con Docker: Gestiona dependencias y unifica entornos
Micael Gallego
 
PDF
Maven beyond hello_world
Gabriel Dogaru
 
PPTX
Organize your chickens: NuGet for the enterprise
Maarten Balliauw
 
ODP
Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)
Per Henrik Lausten
 
PDF
PuppetConf track overview: Modern Infrastructure
Puppet
 
ODP
Jenkins 101: Continuos Integration with Jenkins
All Things Open
 
PDF
Performance Profiling Tools and Tricks
Phase2
 
PDF
Building Good Containers for Python Applications
All Things Open
 
PDF
Testing cloud and kubernetes applications - ElasTest
Micael Gallego
 
PDF
OSDC 2017 - Julien Pivotto - Automating Jenkins
NETWAYS
 
PDF
Deploying software at Scale
Kris Buytaert
 
PPTX
Cooking the Cake for Nuget packages
Sergey Dzyuban
 
PDF
Introduction to Containers: From Docker to Kubernetes and everything in-between
All Things Open
 
PDF
Gitlab Training with GIT and SourceTree
Teerapat Khunpech
 
PDF
ApacheCon Europe 2016 : CONTAINERS IN ACTION - Transform Application Delivery...
Daniel Oh
 
PPTX
Contributing to OpenStack
devkulkarni
 
PDF
2014 land your-first_patch_neutron
Rossella Sblendido
 
PPTX
OpenDaylight Developer Experience 2.0
Michael Vorburger
 
Introduction to package manager
yashobantabai
 
Using nu get the way you should svcc
Maarten Balliauw
 
Testing fácil con Docker: Gestiona dependencias y unifica entornos
Micael Gallego
 
Maven beyond hello_world
Gabriel Dogaru
 
Organize your chickens: NuGet for the enterprise
Maarten Balliauw
 
Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)
Per Henrik Lausten
 
PuppetConf track overview: Modern Infrastructure
Puppet
 
Jenkins 101: Continuos Integration with Jenkins
All Things Open
 
Performance Profiling Tools and Tricks
Phase2
 
Building Good Containers for Python Applications
All Things Open
 
Testing cloud and kubernetes applications - ElasTest
Micael Gallego
 
OSDC 2017 - Julien Pivotto - Automating Jenkins
NETWAYS
 
Deploying software at Scale
Kris Buytaert
 
Cooking the Cake for Nuget packages
Sergey Dzyuban
 
Introduction to Containers: From Docker to Kubernetes and everything in-between
All Things Open
 
Gitlab Training with GIT and SourceTree
Teerapat Khunpech
 
ApacheCon Europe 2016 : CONTAINERS IN ACTION - Transform Application Delivery...
Daniel Oh
 
Contributing to OpenStack
devkulkarni
 
2014 land your-first_patch_neutron
Rossella Sblendido
 
OpenDaylight Developer Experience 2.0
Michael Vorburger
 

Viewers also liked (20)

PPTX
Running in the Cloud - First Belgian Azure project
Maarten Balliauw
 
PPTX
Fun with ASP.NET MVC 3, MEF and NuGet (#comdaybe)
Maarten Balliauw
 
PPTX
NuGet vs Maven
Miguel Fernández
 
PPTX
Unit testing with NUnit
kleinron
 
PPTX
NuGet 3.0 - Transitioning from OData to JSON-LD
Jeff Handley
 
PPTX
Unit Testing (C#)
Prashant Cholachagudd
 
PPT
N Unit Presentation
priya_trivedi
 
PPTX
NUnit Features Presentation
Shir Brass
 
ODP
Easymock Tutorial
Sbin m
 
PDF
An Introduction to Unit Test Using NUnit
weili_at_slideshare
 
PPTX
Types of pattern
Vikrant Sharma
 
PPTX
Gestion paquetes NuGet con Visual Studio Team Services y MyGet
Luis Fraile
 
PDF
Domain-Driven Design with ASP.NET MVC
Steven Smith
 
PPTX
Implementing DDD with C#
Pascal Laurin
 
PPT
ASP.NET MVC Presentation
ivpol
 
PPTX
Introduction to ASP.NET MVC
Khaled Musaied
 
PDF
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
PPT
Mvc architecture
Surbhi Panhalkar
 
PPT
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Svetlin Nakov
 
Running in the Cloud - First Belgian Azure project
Maarten Balliauw
 
Fun with ASP.NET MVC 3, MEF and NuGet (#comdaybe)
Maarten Balliauw
 
NuGet vs Maven
Miguel Fernández
 
Unit testing with NUnit
kleinron
 
NuGet 3.0 - Transitioning from OData to JSON-LD
Jeff Handley
 
Unit Testing (C#)
Prashant Cholachagudd
 
N Unit Presentation
priya_trivedi
 
NUnit Features Presentation
Shir Brass
 
Easymock Tutorial
Sbin m
 
An Introduction to Unit Test Using NUnit
weili_at_slideshare
 
Types of pattern
Vikrant Sharma
 
Gestion paquetes NuGet con Visual Studio Team Services y MyGet
Luis Fraile
 
Domain-Driven Design with ASP.NET MVC
Steven Smith
 
Implementing DDD with C#
Pascal Laurin
 
ASP.NET MVC Presentation
ivpol
 
Introduction to ASP.NET MVC
Khaled Musaied
 
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
Mvc architecture
Surbhi Panhalkar
 
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Svetlin Nakov
 
Ad

Similar to Using NuGet the way you should - TechDays NL 2014 (20)

PPTX
NuGet beyond Hello World - DotNext Piter 2017
Maarten Balliauw
 
PPTX
Visug - organize your chickens - nuget for the enterprise
Xavier Decoster
 
PPTX
ConFoo - NuGet beyond Hello World
Maarten Balliauw
 
PPTX
20111010 agile minds - organize your chickens - nuget for the enterprise
Xavier Decoster
 
PPTX
Evolution of NuGet
Jeff Handley
 
PPTX
SDC Sweden - Organize your chickens - NuGet for the Enterprise
Maarten Balliauw
 
PPTX
NuGet (Anti-)Patterns - Tales from the Trenches
Xavier Decoster
 
PDF
Developing a Community and an Ecosystem with NuGet
Paula Hunter
 
PPTX
Organize your chickens - NuGet for the Enterprise
Xavier Decoster
 
PPSX
Organize your Chickens - NuGet for the Enterprise (UGIALTNET)
Xavier Decoster
 
PPTX
NuGet Packages Presentation (DoT NeT).pptx
Knoldus Inc.
 
PPTX
Controlling Component Chaos with NuGet and Versioning
Perforce
 
KEY
Release management with NuGet/Chocolatey/JIRA
Yaroslav Serhieiev
 
PPTX
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
Daniel Fisher
 
PPTX
Organize your chickens: NuGet for the enterprise
Maarten Balliauw
 
PPTX
Using NuGet libraries in your application
Andrei Marukovich
 
PPTX
Fun with ASP.NET MVC3, MEF and NuGet
Maarten Balliauw
 
PPTX
Mvc dev rocks 00 apr 26, 2014 - creating and using nu get in your own house...
Suthep Sangvirotjanaphat
 
PPTX
Package Repositories: The Unsung Heroes of Configuration and Release Managem...
IBM UrbanCode Products
 
PPTX
Continuous Integration & Package Management 101
Maor Hayun
 
NuGet beyond Hello World - DotNext Piter 2017
Maarten Balliauw
 
Visug - organize your chickens - nuget for the enterprise
Xavier Decoster
 
ConFoo - NuGet beyond Hello World
Maarten Balliauw
 
20111010 agile minds - organize your chickens - nuget for the enterprise
Xavier Decoster
 
Evolution of NuGet
Jeff Handley
 
SDC Sweden - Organize your chickens - NuGet for the Enterprise
Maarten Balliauw
 
NuGet (Anti-)Patterns - Tales from the Trenches
Xavier Decoster
 
Developing a Community and an Ecosystem with NuGet
Paula Hunter
 
Organize your chickens - NuGet for the Enterprise
Xavier Decoster
 
Organize your Chickens - NuGet for the Enterprise (UGIALTNET)
Xavier Decoster
 
NuGet Packages Presentation (DoT NeT).pptx
Knoldus Inc.
 
Controlling Component Chaos with NuGet and Versioning
Perforce
 
Release management with NuGet/Chocolatey/JIRA
Yaroslav Serhieiev
 
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
Daniel Fisher
 
Organize your chickens: NuGet for the enterprise
Maarten Balliauw
 
Using NuGet libraries in your application
Andrei Marukovich
 
Fun with ASP.NET MVC3, MEF and NuGet
Maarten Balliauw
 
Mvc dev rocks 00 apr 26, 2014 - creating and using nu get in your own house...
Suthep Sangvirotjanaphat
 
Package Repositories: The Unsung Heroes of Configuration and Release Managem...
IBM UrbanCode Products
 
Continuous Integration & Package Management 101
Maor Hayun
 
Ad

More from Maarten Balliauw (20)

PPTX
Bringing nullability into existing code - dammit is not the answer.pptx
Maarten Balliauw
 
PPTX
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Maarten Balliauw
 
PPTX
Building a friendly .NET SDK to connect to Space
Maarten Balliauw
 
PPTX
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Maarten Balliauw
 
PPTX
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Maarten Balliauw
 
PPTX
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw
 
PPTX
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
Maarten Balliauw
 
PPTX
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
Maarten Balliauw
 
PPTX
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw
 
PPTX
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
Maarten Balliauw
 
PPTX
Approaches for application request throttling - Cloud Developer Days Poland
Maarten Balliauw
 
PPTX
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Maarten Balliauw
 
PPTX
Approaches for application request throttling - dotNetCologne
Maarten Balliauw
 
PPTX
CodeStock - Exploring .NET memory management - a trip down memory lane
Maarten Balliauw
 
PPTX
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
Maarten Balliauw
 
PPTX
ConFoo Montreal - Approaches for application request throttling
Maarten Balliauw
 
PPTX
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Maarten Balliauw
 
PPTX
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
Maarten Balliauw
 
PPTX
DotNetFest - Let’s refresh our memory! Memory management in .NET
Maarten Balliauw
 
PPTX
VISUG - Approaches for application request throttling
Maarten Balliauw
 
Bringing nullability into existing code - dammit is not the answer.pptx
Maarten Balliauw
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Maarten Balliauw
 
Building a friendly .NET SDK to connect to Space
Maarten Balliauw
 
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Maarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Maarten Balliauw
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw
 
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
Maarten Balliauw
 
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
Maarten Balliauw
 
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw
 
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
Maarten Balliauw
 
Approaches for application request throttling - Cloud Developer Days Poland
Maarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Maarten Balliauw
 
Approaches for application request throttling - dotNetCologne
Maarten Balliauw
 
CodeStock - Exploring .NET memory management - a trip down memory lane
Maarten Balliauw
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
Maarten Balliauw
 
ConFoo Montreal - Approaches for application request throttling
Maarten Balliauw
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Maarten Balliauw
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
Maarten Balliauw
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
Maarten Balliauw
 
VISUG - Approaches for application request throttling
Maarten Balliauw
 

Recently uploaded (20)

PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Digital Circuits, important subject in CS
contactparinay1
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 

Using NuGet the way you should - TechDays NL 2014

  • 2. Laat ons weten wat u vindt van deze sessie! Vul de evaluatie in via www.techdaysapp.nl en maak kans op een van de 20 prijzen*. Prijswinnaars worden bekend gemaakt via Twitter (#TechDaysNL). Gebruik hiervoor de code op uw badge. Let us know how you feel about this session! Give your feedback via www.techdaysapp.nl and possibly win one of the 20 prizes*. Winners will be announced via Twitter (#TechDaysNL). Use your personal code on your badge. * Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are examples
  • 3. Using NuGet the way you should Maarten Balliauw @maartenballiauw
  • 4. Who am I? • Maarten Balliauw • Antwerp, Belgium • Technical Evangelist, JetBrains • Founder, MyGet • AZUG • Focus on web • ASP.NET MVC, Azure, SignalR, ... • MVP Azure & ASPInsider • Big passion: Azure • http://blog.maartenballiauw.be • @maartenballiauw Shameless self promotion: Pro NuGet - http://amzn.to/pronuget2
  • 5. Agenda • NuGet • File | New Project… • The state of NuGet • Every project is a package • Creating packages • Distributing packages • Consuming packages
  • 7. A brief NuGet introduction... • Package management system for .NET • Visual Studio extension, command line, console • Simplifies incorporating 3rd party libraries • Developer focused • Free, open source • Use packages from the official feed • Publish your own packages • Create & use your own feed
  • 9. Demo File | New Project...
  • 10. That was trouble! •Dependencies on NuGet packages •Dependencies on projects •Dependencies on file system layout •Breaking changes in dependencies Dependency hell
  • 11. “Dependencies, also in real life, are trouble. Have you ever had to depend on a plumber?” - Maarten Balliauw
  • 12. Dependencies before NuGet •Projects in solution •Reference in-house projects: • Either the assemblies (typically unversioned / all 1.0.0.0) • Either the actual project / linked files (unversioned by design) •Reference third party assemblies (e.g. JSON.NET)
  • 13. Dependencies with NuGet •Projects in solution •Reference in-house projects: • Either the assemblies (typically unversioned / all 1.0.0.0) • Either the actual project / linked files (unversioned by design) •Reference third party packages (e.g. JSON.NET) • Semantic Versioning to announce breaking changes (happy times as long as package authors respect that)
  • 15. The state of NuGet •We are consumers! • Even quite some overconsumption I dare say… •We sort of know about Semantic Versioning • If the mayor version changes, we’re doomed •Are we producing? • Some are, e.g. OSS and some companies •Did we solve our dependency issues? Where are we, 3 years in?
  • 16. .NET is late to the party! •Others have been doing package management for decades • Perl (CPAN.org) • Linux (RPM/YUM/APT-GET/...) • PHP (PEAR, Composer) • Node (npm) • Ruby (Gems) •We can learn a great deal from these!
  • 17. What are the others doing? { "name" : "IniTech.Framework.Formatters", "version" : "1.0.0 ", "author" : "Maarten Balliauw", "bugs" : { "url" : "https://github.com/initech/framework-formatters/issues" }, "description" : "Formatters specific to the IniTech organization.", "homepage" : "https://github.com/initech/framework-formatters", "keywords" : [ "framework", "formatters", "initech" ], "license" : "Proprietary", "main" : "index.js", "repository" : { "type" : "git", "url" : "https://github.com/initech/framework-formatters" }, "scripts" : { "test" : "echo "Error: no test specified" && exit 1" }, "dependencies" : { "date-format" : "0.0.2", "format" : "~0.2.1", "moment" : "~2.5.1" } }
  • 18. What are the others doing? •Name and version of the project •Dependencies (and version range) of the project •Every project is a package! • It can have dependencies • It can be depended on What was in that package.json?
  • 19. Every project is a package
  • 20. Supporting componentization •Every project is a package • Clearly identifyable • Proper Semantic Versioning •Every project becomes discoverable • Nice description, release notes, ... • Add it to a private feed so developers can find it •Dependencies (can) stay out of source control •Dependencies are versioned
  • 21. But… NuGet only has packages.config! •Nodejs: packages.json •Composer (PHP): composer.json •NuGet: • packages.config: dependencies • <projectname>.nuspec: package description • NuGet.config: other settings • It’s 2-3 files in our world, but it is all there. •Let’s become producers!
  • 24. All we need is one file •XML file which can be generated • nuget.exe spec • Install-Package NuSpec && Install-Nuspec •Run nuget.exe pack to create package <projectname>.nuspec
  • 26. Think about versioning! • www.semver.org • SemVer states intentions • It’s the only way to avoid dependency versioning hell. But not bullet-proof. Enforce Explicit Semantic Versioning Major Breaking changes Minor Backwards compatible changes e.g. API additions Patch Bugfixes not affecting the API <dependency id="ExamplePackage" version="1.3.2" /> 1.0 = 1.0 ≤ x (,1.0] = x ≤ 1.0 (,1.0) = x < 1.0 [1.0] = x == 1.0 (1.0) = invalid (1.0,) = 1.0 < x (1.0,2.0) = 1.0 < x < 2.0 [1.0,2.0] = 1.0 ≤ x ≤ 2.0 empty = latest version
  • 28. Which medium? • In source control (please don’t) • Local / network folder (slow > ~50 packages) • NuGet.Server (slow > ~50 packages) • NuGet Gallery (clone of www.nuget.org) • MyGet (www.myget.org, SaaS) • ProGet (www.inedo.com/proget) • TeamCity NuGet artifacts (www.jetbrains.com/teamcity) We will need a “package source” or feed
  • 29. How do they get there? •Manual upload •As part of our continuous integration process • All benefits of CI (e.g. testing) • Plus reporting on which packages we are using • Plus publishing packages for consumption
  • 31. What did we just see? •Creating packages using .nuspec •NuGet configuration inheritance •Continuous Integration on TeamCity • How to run package restore • How to build a package • How to see packages that are being used •How to consume a package
  • 32. NuGet configuration inheritance •Make settings common to projects! • NuGet walks up the directory tree to find NuGet.config files •Or even push them to developer machines • %AppData%NuGetNuGet.config • %ProgramData%NuGetConfig*.config • ... •See http://bit.ly/nuget-config-inheritance •Configure feeds, proxy, credentials, ...
  • 33. More recommendations… •Don’t just update blindly • Not everyone respects SemVer… • It would take us back to the original problem •Don’t autoupdate during builds • Continuous Integration: Same Input = Same Output • Be explicit about versioning
  • 34. Deploying from NuGet packages •Using a simple, handcrafted script •Using a tool like OctopusDeploy.com • Which is even cooler combined with Chocolatey.org •TeamCity supports various ways of deploying (e.g. WebDeploy)
  • 36. Considerations •TeamCity internal NuGet feed • Only build artifacts • No way to add external packages that are being used • May not be a problem for your setup • But maybe it is: a feed is much like source control for dependencies • Add dependencies that are being used, NuGet.org, component vendors, ... • If it is, create your own feed, e.g. MyGet.org
  • 37. Create a package source / feed •That’s a cool library! And that one too! • Avoid overconsumption by limiting packages • May not block developers but at least the build will fail •Your own feed will only contain packages you know • Keep versions under control • Keep licensing under control • Easy way to audit external packages in use For your team or the entire organization
  • 40. Conclusions • NuGet • File | New Project… • The state of NuGet • Every project is a package • Creating packages • Distributing packages • Consuming packages What have we learned?
  • 41. “Stop just consuming NuGet packages. Re- think your development by also creating them. It’s a logical evolution.” - Maarten Balliauw
  • 43. Laat ons weten wat u vindt van deze sessie! Vul de evaluatie in via www.techdaysapp.nl en maak kans op een van de 20 prijzen*. Prijswinnaars worden bekend gemaakt via Twitter (#TechDaysNL). Gebruik hiervoor de code op uw badge. Let us know how you feel about this session! Give your feedback via www.techdaysapp.nl and possibly win one of the 20 prizes*. Winners will be announced via Twitter (#TechDaysNL). Use your personal code on your badge. * Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are examples

Editor's Notes

  • #6: Maarten
  • #11: Open IniTech.TpsReports solutionExplain demo application we will be buildingExplain we will skip the actual File | New Project... Because of demo purposes, but we will cover the steps right after thatGo through HomeController and the related views and model classesLet’s add some NuGet Goodness!Bootstrap DatepickerELMAH for diagnosticsRun updates! We are get-latest addicts!Next, explain that for date formatting, we need one of our own projects. Which is located somewhere on my disk in another github repository from the framework code team enterprise architects.Open TpsRepoortCoversheet.cshtml and add referenceThat is awesome! Build, run and demonstrate the application.Switch hats: become the architect and open IniTech.Framework solutionA good architect refactors! Let’s switch namespaces. And that formatter,we need a FormatterFactory for that!Close Visual Studio. We also want to move this project in the source repository, because it is not at the best locationSwitch hats again and try compiling IniTech.TpsReports solution...What has happened! RELEASE IS TODAY! HELP! And the architect guy is in a meeting or presenting or something. PANIC!
  • #27: Open IniTech.FrameworksolutionRun a nuget spec and show the file in action (update it and so on)Run nuget pack to package itOpen it in NuGet Package Explorer (explain the tool!) and see hwt is in thereLevel up: add a dependency on Newtonsoft.Json and run nuget pack againOpen in NPE again and see the dependency magically appeared!If you do not want this, add developmentDependency=“true”Open the IniTech.TpsReports solutionDrop the project reference and add a package source,install the framework that wayExplain how it all works and where packages can come from, folder (and NuGet.Server) are a bad idea! (BAD BAD BAD!)Now that we are here... Create a spec, run packaging on the .csprojExplore the package: dependencies are there, contents are in there too
  • #32: Explain TeamCity (CI, project, configuration, build steps)Let’s make sure our IniTech.Framework is packagedCreate project from URL - https://github.com/maartenba-demo/initech-nuget.gitAutodetected build steps: none in this case?Add build step: package restoreSolution file: src/framework/IniTech.Framework/IniTech.Framework.slnRestore mode: restoreExplain other options and their evilness (autoupdate? noooo!)Mention because of the private feed we are using (TeamCIty itself), we want to add authentication there as wellAdd build step: build solutionSolution file: src/framework/IniTech.Framework/IniTech.Framework.slnAdd build step: packProject file: src/framework/IniTech.Framework/IniTech.Framework/IniTech.Framework.csprojVersion: 1.0.%build.number%Output: “artifacts” + tick publish to artifacts to make the package visible on the TeamCity NuGet feedRun a build, see package has been created. Run a NuGet.exe listnuget list -Source http://teamcity.balliauw.net/httpAuth/app/nuget/v1/FeedService.svcSources: %teamcity.nuget.feed.auth.server% and https://nuget.org/api/v2Switch to the existing build configuration for the IniTech.TpsReports solutionExplain same setup: package restore, build, packEdit the package restore step and mention for this configuration we are using the TeamCity server itself as a package source, as well as NuGet.orgRun a build, see the results tabs and get an inventory of all packages consumedOpen IniTech.Frameworksolution, make a change, commit, buildOpen the IniTech.TpsReports solution, update packages, keep workingExplain that when the framework would have a breaking change, we have to update the version number so developers will see there are breaking changes and they will have work to do when they update for the update.How do developers know about the feeds to use?Open the NuGet.config file, mention inheritance, mention developers will automatically have that feed availablePackage restore: close the solution, delete the packages folder, open and buildExplain no need to use the Enable package restore menu anymore (in fact, it will hurt you)If package restore fails (which happens a lot when fiddling with settings), make sure the (Aggregate Source) is selected in the NuGet.config file so ALL feeds are checked, not just one
  • #37: Similar to consuming packages in Visual Studio, only command line this timeDo a nuget list -Source http://teamcity.balliauw.net/httpAuth/app/nuget/v1/FeedService.svcExplain we can get all packages, install them, ...We know this is a web application, so let us create a deploy.batOpen the existing oneExplain the steps in thereExplain we are installing without version number in paths so we can more easily script somethingFeel free to add database deployment in a similar way, calling into SQL Server command lineFeel free to add DevOps stuff: why not create a new Windows Azure VM using th CLI tools they have and then FTP the NuGet contents up there?Mention this is quite archaic but it works. You have to know the project you will be deploying and that is it.Mention we could also run this script from TeamCity, in fact we have a demo on thatShow the configuration thereShow the snapshot dependencyShow promoting buildMention OctopusDeploy.com again, show it on screen quickly, explain it is a good companion to TeamCity:Build on one, convention-based deployments with the other
  • #40: Explain setup: instead of using the TeamCity internal feed we want to use another oneThe reason for that is: we don’t want to have just our build artifacts on there, but we want to make it the only feed of thruth (much like a VCS does for sources, this feed will do so for dependencies)Quickly create a feed on MyGet, add dependencies from the IniTech.TpsReports solution by uploading packages.config. Make sure they are mirrored.Also configure the framework build to push there and run it.Delete package sources in the IniTech.TpsReports solution and add our one source of thruthAll developers can now only use these approved packages + in-house artifacts that are createdOption: create an “unstable” feed to test out new versions and migrate to teh “real” feed when they get approved (there is a push upstream feature for that on MyGet)