O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

NuGet 2 Essentials

Book Description

A clearly written guide for .NET developers who want to get to grips with the NuGet package manager. Filled with practical examples, it leads up to teaching you how to set up your own internal server.

  • Easily find and refer third-party libraries from your projects
  • Create packages from your class libraries for others to use and publish them to the official NuGet gallery
  • Host your own internal NuGet server and publish packages to it

In Detail

NuGet has made the process of finding and referencing libraries from Visual Studio much easier and has strongly contributed to the expansion of an open source ecosystem. In the three years since its release, it has become an essential tool for both consuming and publishing class libraries for the .NET framework.

A concise and practical guide to everything that NuGet has to offer to both consumers and publishers. Through many hands on examples, NuGet2 Essentials will demonstrate all of NuGet’s features and teach you how to use them in everyday development in a .NET framework.

Starting out by using NuGet for consuming third-party libraries, this concise guide continues with a detailed look at creating your own packages, and ends by teaching you how to set up your own internal server. Through practical examples, you will learn to manage versions of installed libraries on all development and build machines. You will also discover how to create packages for your own libraries so they can be easily consumed, no matter how much configuration they require. By hosting an internal server, you will have full control of packages being used in your development environment.

By the end of the book, you will know about everything that NuGet has to offer, and how it can make your development process better.

Table of Contents

  1. NuGet 2 Essentials
    1. Table of Contents
    2. NuGet 2 Essentials
    3. Credits
    4. Foreword
    5. About the Authors
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Using a Package Manager in Visual Studio
      1. Benefits of using a package manager
      2. Manually adding third-party library references
      3. Setting up NuGet in Visual Studio
        1. Requirements
        2. Installing NuGet
          1. Installing from the Visual Studio gallery
          2. Installing from the Extension Manager
          3. Installing the command-line utility
      4. Adding references to third-party libraries using NuGet
        1. Dependencies with NuGet
      5. Summary
    10. 2. Package Management
      1. Updating referenced third-party libraries
        1. Updating an installed package
        2. Local package version management
      2. Support for different target platforms
        1. Installing a package for an unsupported target platform
      3. Using NuGet with source control
        1. Using NuGet on a build server
      4. Using Package Manager Console
      5. Summary
    11. 3. Creating and Publishing a Package
      1. Creating a package with NuGet Package Explorer
        1. Dependencies
      2. Publishing the package to the official NuGet Gallery
      3. Creating and publishing a package from the command line
        1. Creating a NuGet specification
        2. Packing the package
        3. Publishing the package
      4. Generating the package during the build process
      5. Understanding package versioning
        1. SemVer
        2. The prerelease packages
      6. Summary
    12. 4. Adding Features to a NuGet Package
      1. Package folder structure
      2. Multiplatform support
        1. Testing a NuGet package locally
        2. Folder naming conventions
      3. Packaging localized satellite assemblies
        1. Adding localized assemblies to the main package
        2. Creating satellite packages
      4. Adding new files and modifying existing ones
        1. Transforming configuration files
          1. The XML-Document-Transform syntax
        2. Adding source code files
          1. Visual Studio project properties
        3. Adding MSBuild targets and properties
      5. Including PowerShell scripts in a package
        1. Running a script at install time
        2. Adding a PowerShell module
      6. Debugging of packages
        1. Creating and publishing a symbol package
        2. Consuming a symbol package
      7. Summary
    13. 5. Hosting an Internal NuGet Server
      1. Understanding reasons for hosting NuGet internally
      2. Creating a NuGet package repository
        1. Creating a filesystem-based NuGet repository
          1. The NuGet cache
        2. Creating a lightweight NuGet server
          1. Configuring the NuGet server
          2. Accessing packages
          3. Using a private feed with package restore
        3. The NuGet Gallery
          1. Prerequisites
          2. Installing the NuGet Gallery
          3. Configuring and compiling the NuGet Gallery
      3. NuGet server in a continuous integration system
      4. Summary
    14. Index