Foreword

Microsoft can never meet the code needs of every developer. The world is simply too rich and diversified. It wouldn’t make sense for Microsoft to invest in libraries to meet every need. Instead, Microsoft focuses on foundational libraries, while its community of developers have taken it upon themselves to write thousands upon thousands of useful libraries and utilities.

Microsoft started the NuGet project to make it easier for developers to discover and distribute one another’s libraries. A healthy ecosystem of developers who share code and build libraries is good for Microsoft and good for developers.

But then, an interesting thing happened. Microsoft donated the project and its employees’ time to the Outercurve Foundation, a foundation meant to foster open source collaboration with corporations. NuGet is an Apache v2 licensed open source project that accepts contributions from outside Microsoft.

In doing so, Microsoft truly made NuGet a project that belongs to the community. At the same time, Microsoft plans to ship it within its products. It’s now available to a huge number of developers as a core component of Visual Studio 2012. NuGet represents a new way for Microsoft to work with the community while delivering a great product.

Although NuGet was designed to be very easy to start working with, NuGet supports more than one workflow, such as checking in packages to source control, or restoring them during compilation. Recent versions of NuGet add support for the Portable Class Library project, the new way forward for writing cross-platform libraries with .NET.

This is why I’m excited about the second edition of Pro Nuget. NuGet is simple to get started, but simple tools often have many powerful uses. From very early on, Maarten and Xavier have been involved with NuGet, contributing ideas and building products based on NuGet such as http://MyGet.org, a site for hosting custom (and optionally private) NuGet repositories.

What I hope you get from this book is a sense of all the ways that NuGet can help streamline your day-to-day development and even make it more fun to write code. And for those of you who want to take it further, why not come over and contribute?

—Phil Haack

Project Lead, NuGet

When NuGet was introduced as part of the ASP.NET MVC 3 release in January of 2011, I was intrigued. To be honest, though, the implications of Microsoft shipping a package manager for .NET (let alone an open source one) didn’t sink in at first. It wasn’t until a few months after publishing my first set of packages (for the WCF RIA Services Toolkit) that it really hit me. Then in August of 2011, I published a blog post entitled “I Get NuGet. You Get NuGet?” that opened with the admission, “Hello, my name is Jeff, and I am addicted to NuGet.” Less than a month later, somewhat by chance, I got the opportunity to become the development lead for NuGet and I could barely contain my excitement!

At that time NuGet was still a nascent project. There were fewer than 3,000 unique packages, and there had been 1.7 million package downloads. But more noteworthy than that, NuGet was really being used in only ASP.NET projects, and it wasn’t yet shipping as part of Visual Studio. Two years later, NuGet is now included in every edition (free and paid) of Visual Studio—but we had to work hard to make that happen. NuGet supports virtually every project type, including .NET, Silverlight, Windows Store, Windows Phone, Portable Class Library, LightSwitch, F#, C++, WiX, and many more. NuGet also supports a wide range of development environment scenarios, aiming to work for all Visual Studio users. There are over 15,000 unique packages and 100 million package downloads, and these numbers are growing steadily. NuGet is no longer just the package manager for .NET; it’s the package manager for the Microsoft development platform.

Whether you’re an independent developer working on an open source project, a consultant for small businesses, or an enterprise developer, NuGet is becoming an essential part of your development workflow. Long before this became a reality, though, Maarten Balliauw and Xavier Decoster knew it was inevitable. They became two of the earliest NuGet enthusiasts and started amassing a deep and broad understanding of how to employ NuGet for significant benefits to software development and maintenance. With their writing and their ecosystem contributions including MyGet.org (NuGet-as-a-Service), Maarten and Xavier have proven themselves as leading NuGet experts.

Especially considering how much NuGet and its ecosystem have grown over the past couple of years, I am glad Maarten and Xavier have written Pro NuGet, Second Edition. This book explains how to consume NuGet packages in your projects, how packages are authored and published, and how you can use several different approaches for hosting your own private or public NuGet feeds. Pro NuGet demonstrates how to use valuable NuGet concepts such as package restore so that your builds and build servers can automatically download the right packages. Maarten and Xavier have also illustrated how to extend NuGet to further meet your needs with ecosystem tools or even your own extensions. The book even shows how to use NuGet as an implementation detail for your own extensible systems.

Whether you are just learning what NuGet and package management are, or you are already a daily NuGet user, I promise this book will teach you how to get more value from NuGet. As I was reading through the book, I was really impressed at how thorough Maarten and Xavier have been on so many topics, and I learned several new things myself.

—Jeff Handley

Microsoft Development Lead for NuGet

The NuGet train continues. Have you seen the stats? No? Head on over to www.nuget.org/stats. I’ll wait here. See that? Literally millions of clients installed, and 7+ million packages downloaded per month. NuGet is the best thing to happen to open source and Microsoft since, well, since the beginning. I enjoy working for Microsoft and I’ve been doing open source for well over a decade, but getting open source libraries into my projects has always been a hassle. Where is the site? Which file to download? Where do I put it? Which DLL do I get and what framework version? Too many clicks. Now, NuGet.

We in the .NET community have been jealous of RubyGems and Java Maven and all the other package management solutions for developers. It took a while, but Microsoft finally released an open source project that takes commits from non-Microsoft developers and enhances the .NET developer ecosystem. NuGet was a little late in coming, but it’s here and I don’t know how I wrote software without it.

When this book first came out, there were 3.5 million package downloads in total. With this newly refreshed edition, NuGet surpassed those download numbers every two weeks. Not only that, but NuGet is also officially included in every Visual Studio edition, from Express to Ultimate, from Windows Phone to Web. Everyone who uses NuGet suddenly can’t live without it.

Why do we need a book on NuGet? Because NuGet is a building block on top of which many other things can be built. Not just NuGet packages and .NET libraries, but innovative services, starter kits, web frameworks, scaffolders, installers, and all sorts of crazy stuff that the NuGet team never imagined.

We’ve already seen commercial software vendors like JetBrains build NuGet support directly into their TeamCity product, as well as tools and component companies like DevExpress create private NuGet feeds to support the enterprise. NuGet is open source, but it’s more than just open source. It’s about making building software with new, original and pioneering libraries in your application as easy as File ä Add Reference.

I’m happy to be part of this community and, in some small way, to contribute to NuGet and its success. I hope by reading this book that you will become part of that success story!

—Scott Hanselman

Principal Community Architect—ASP.NET/IIS/NuGet Microsoft

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.51.157