13
Using NuGet libraries in your application Andrei Marukovich LunarFrog.com twitter: @amarukovich

Using NuGet libraries in your application

Embed Size (px)

Citation preview

Page 1: Using NuGet libraries in your application

Using NuGet libraries in your application

Andrei MarukovichLunarFrog.comtwitter: @amarukovich

Page 2: Using NuGet libraries in your application

What is NuGet?• Package Gallery with 65,000+ unique packages• Package manager with CLI and VS clients• NuGet libraries

Page 3: Using NuGet libraries in your application

Usage of the NuGet libraries• NuGet tool• Chocolatey• Squirrel• Wyam• Cake• ReSharper• LINQPad• scriptcs

Page 4: Using NuGet libraries in your application

What we are going to discuss• Package anatomy• Package authoring• Consuming packages using NuGet API

Page 5: Using NuGet libraries in your application

Package anatomy• Package is a .zip archive with .nupkg extension

XYZ.nupkg

\lib\net40

\xyz.dll\uwp10.0

\xyz.dll\netstandard13

\xyz.dll\content\toolsxyz.nuspec

Page 6: Using NuGet libraries in your application

Package authoring

Page 7: Using NuGet libraries in your application

Usage scenarios for NuGet API• Dynamically compose an application from NuGet

packages• Install/update an app plugin as a NuGet package

Page 8: Using NuGet libraries in your application

Demo workflow• Prepare package sources • NuGet.org, MyGet.net, local folder, etc.

• Identify a list of packages to install• A list of top level packages, requested by user or application

• Request NuGet to discover dependencies for the targeted packages• Install packages• Install target packages• Recursively install dependencies

• Use packages

Page 9: Using NuGet libraries in your application

Notes• NuGet is composed from more than 30 libraries• Demonstrated workflow uses 9 of this libraries• Top level packages• NuGet.DependencyResolver • NuGet.Protocol.Core.v3

• Sample is based on NuGet 3.5.0-rc1-final• API may change before the release

Page 10: Using NuGet libraries in your application

NuGet API

Page 11: Using NuGet libraries in your application

Recap• Defined package feed and available resources• PackageSource and SourceRepository

• Defined required packages• IProjectDependencyProvider and LibraryDependency

• Discovered dependencies• RemoteDependencyWalker

• Installed packages• PackageExtractor

Page 12: Using NuGet libraries in your application

More information• lunarfrog.com/blog• docs.nuget.org• \API\NuGet API V3

Page 13: Using NuGet libraries in your application

Thank you!

Andrei [email protected]: @amarukovich