NuGet Kibbles And Bits: Learn How To Build And Publish A NuGet Package

Preview:

Citation preview

Learn How to Build and Publish a NuGet Package

nugetpackage manager flavor

100% Complete &Balanced Code

For DevelopersOf All Skill Levels

Chris Bohatka

@cjb5790

http://chris.bohatka.com

.NET Web Developer

UX

Clean Code

• Founded in 1999 in Cleveland, OH • Global leader and pioneer in enabling

authenticated payments, secure transactions and alternative payment brands

TokenizationMobile Solution DesignConsumerAuthentication

AlternativePayments

Some Cardinal Customers

Available Positions

• Operations Database Specialist• Technical Services Specialist• Production Engineering Specialist• Software Sentry• Software Developer• Boarding Specialist• Product Experience Intern• Marketing Intern• https://www.cardinalcommerce.com/about/careers

You get a package manager, and you get a package manager, and you get a package manager…everyone gets a package manager!

You get a package manager, and you get a package manager, and you get a package manager…everyone gets a package manager!

What is NuGet?

Why NuGet?• Convenient

• Built into Visual Studio

• Restore on build

• Don’t enable NuGet Package Restore

• Dependency Management

• DRY (Don’t Repeat Yourself)

What can we include in a NuGet package?

Helpers/Utilities

Extensions

API’s

Roslyn Code Analyzers

Components

User Controls

Tag Helpers

Libraries (CSS, JS)

Configurations

Binaries (DLL's)

Package Components

.nupsec

Existing Project

+

=.nupkg

Let’s Create Our First Package…• Install nuget.exe

• Move to C:\nuget

• Add C:\nuget to your PATH

NuGet Spec• Navigate to project directory

• Run:

NuGetDemo.nuspec

<?xml version="1.0"?><package > <metadata> <id>$id$</id> <version>$version$</version> <title>$title$</title> <authors>$author$</authors> <owners>$author$</owners> <licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl> <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl> <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>$description$</description> <releaseNotes>Summary of changes made in this release of the package.</releaseNotes> <copyright>Copyright 2015</copyright> <tags>Tag1 Tag2</tags> </metadata></package>

Generating the Package• “nuget pack”

NuGet Package Explorer• http://npe.codeplex.com

Publish

Publish CLI• “nuget push [nupkg] [apiKey]”

DEMO

Let’s Write Some Code!(kinda)

Resources• http://docs.nuget.org

Thank You

@cjb5790