2011 - Dotnet Information Day: NUGET

44
devcoach.co m NuGet .NET Package Management Daniel Fisher | devcoach

Transcript of 2011 - Dotnet Information Day: NUGET

devcoach.com

NuGet.NET Package ManagementDaniel Fisher | devcoach

devcoach.com

devcoach.comBERTAUNG + SCHULUNG + PROJEKTE

• Themen– Architektur & Technologie

Evaluierung, Performance Optimierung, Entwicklungs-Unterstützung, Security Reviews, QA, POC & Know-how-Transfer

• Technologien– Services: WCF & WF– Data: ADO.NET & EF– Web: ASP.NET, MVC & Silverlight

• Kunden– Versicherung, Finanzindustrie,

Mittelstand, Handel, Kommunikation, Softwarehersteller… Und sie?

• Kontakt– [email protected]

devcoach.com

Daniel Fisher• devcoach.com

– Mit-Gründer und Geschäftsführer

• Justcommunity.de– Mit-Gründer und Vorstand

• nrwconf.de– Mit-Gründer und Organisator

• netug-niederrhein.de– Mit-Gründer und Leiter

• microsoft.com– Community Leader & Insider (CLIP)– Certified Professional Developer– Business Platform Technology Advisor

• lennybacon.com– Blog

• twitter.com– @lennybacon

devcoach.com

Efficient Communication…

devcoach.com

devcoach.com

I want to use that library…

devcoach.com

devcoach.com

devcoach.com

Packages

• A package is a bundle of something you want to reuse.– It can have dependencies to other

packages.– It can contain files:• Assemblies• Content• Tools

devcoach.com

NuGet to the Rescue

devcoach.com

What is NuGet

• Open Source Project initiated by Microsoft– http://nuget.codeplex.com/

• Intended to solve the issues related to management of 3rd party assembly dependencies–Microsoft Non .NET Framework stuff– Open Source Libraries– You own libraries!

devcoach.comOf course it was inspired

by…• Linux RPM Package Manager• Ruby Gems• …

devcoach.com

And there are others

• OpenWrap– http://www.openwrap.org/

• Bricks– http://bricksproject.org/

• NGem

devcoach.com

NuGet Components

C#C#WCF Data Services

Gallery Server NuGet Core

VS Addin

Console App

MsBuild Tasks

Package Explorer

devcoach.com

DEMO

devcoach.com

Packages

• NuGet packages follow the packaging specification…– Like Office 2010 whatever-X formats–…

devcoach.com

The dark side …

devcoach.com

Powershell Commands

• Get-Package -ListAvailable• Install-Package {packageid}• Remove-Package {packageid}

devcoach.com

DEMO

devcoach.com

devcoach.com

Profiles

• NuGet_profile.ps1

devcoach.com

CREATING PACKAGES

devcoach.com

NuSpec<?xml version="1.0"?><package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>System.Web.Mvc</id> <version>3.0</version> <authors>Microsoft Corporation</authors> <owners>Microsoft Corporation</owners> <licenseUrl>http://www.asp.net/mvc</licenseUrl> <projectUrl>http://www.asp.net/mvc</projectUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>The Microsoft MVC Framework.</description> <tags>ASP.NET MVC</tags> </metadata></package>

devcoach.com

NuSpec<?xml version="1.0"?><package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>$id$</id> <version>$version$</version> <authors>$author$</authors> <owners>$author$</owners> <licenseUrl>http://www.asp.net/mvc</licenseUrl> <projectUrl>http://www.asp.net/mvc</projectUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>$description$</description> <tags>ASP.NET MVC</tags> </metadata></package>

[assembly: AssemblyTitle("MyLibrary")][assembly: AssemblyDescription("My cool library")][assembly: AssemblyCompany("Daniel Fisher")][assembly: AssemblyProduct("devcoach super tools")][assembly: AssemblyVersion("0.9.0.0")]

devcoach.com

DEMO

devcoach.com

Console App

devcoach.com

Console Commands

• pack {package.nuspec}• push {package.nupkg}

{your_api_key} -src {your_nuget_server}

devcoach.com

CREATING ADVANCED PACKAGES

devcoach.com

devcoach.com

Content

• /content

devcoach.com

DEMO

devcoach.com

Dynamic Content

• File Extension: *.pp• Template Parameters– http://msdn.microsoft.com/en-us/library/

eehb4faa(v=vs.80).aspx

devcoach.com

DEMO

devcoach.com

Transformation

devcoach.com

DEMO

devcoach.com

Powershell

• Install.ps1• Uninstall.ps1• Init.ps1

devcoach.com

DEMO

devcoach.com

devcoach.com

MsBuild Task<?xml version="1.0" encoding="utf-8"?><Project DefaultTargets="PackageBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<UsingTask TaskName="NuPack.NuGet.NuPack" AssemblyFile="NuGet.MSBuild.dll" />

<ItemGroup><NuSpecFiles Include="..\*.*\*.nuspec" />

</ItemGroup>

<Target Name="PackageBuild">

<NuGet.MSBuild.NuGetCondition="Exists(@(NuSpecFiles))"SpecFile="@(NuSpecFiles)" PackageDir="..\bin\" />

</Target>

</Project>

devcoach.com

NuGet Gallery Server

• The server side repository for packages.– Alternative to a local directory or UNC

path.

• Provides an OData interface.–WCF Data Service– Atom PubSub-Feed• http://www.odata.org

devcoach.com

NuGet Gallery Server

devcoach.com

devcoach.com

Where do I get it?

• VS Addin: NuGet Package Manager– http://

visualstudiogallery.msdn.microsoft.com/en-us/27077b70-9dad-4c64-adcf-c7cf6bc9970c

• Console App– http://nuget.codeplex.com/

• MsBuild Tasks– http://nuget.codeplex.com/

• NuGet Explorer– http://nuget.codeplex.com/

• Gallery Server– http://galleryserver.codeplex.com/

devcoach.com

Thank You!

@lennybacon