NuGet for Windows Store App Developers

Visual Studio Blog

In Visual Studio Express 2012 for Windows 8 you’ll see that we have included the popular NuGet package manager by default and customized it to include a Windows 8 packages feed that presents you a filtered list of NuGet packages for use in developing your Windows Store apps.

In case you haven’t heard of NuGet – it’s a package management tool that simplifies discovering, integrating, and managing external dependencies throughout the lifetime of your project. In the most basic scenario – you can use it to search a repository of packages (e.g. libraries like Entity Framework or knockoutjs) and install them in your project. This helps you get up and running quickly without requiring you to go through different websites and installation processes for libraries. Over time, NuGet will also help you keep track of version updates to the different libraries and allow you to update when you’re ready.

Because it so dramatically simplifies the process of managing dependencies for a project, NuGet has become widely used throughout the .NET development community.  As a result, we’ve included NuGet in all versions of Visual Studio 2012 – including Visual Studio Express 2012 for Windows 8. This will provide Windows Store app developers with the same access to components and streamlined integration that has become common for .NET application developers.

The Windows 8 feed isn’t limited to Visual Studio 2012 Express for Windows 8 so we’ll show you below how you can add this to other editions of Visual Studio 2012 as well.

The Windows 8 Packages feed

With Windows 8, the build and reference model has changed from the model used by other managed project types; we made the decision early on to provide a filtered view of the NuGet package library.  This provides 2 high level benefits:

  1. It minimizes the risk of installing a NuGet package that breaks because it wasn’t designed to work with a Windows Store app project
  2. It reduces the amount of “noise” in search results, by focusing only on the set of packages that are known to work well with Windows Store app projects

To get a better idea of the kinds of packages contained in the curated feed, take a look at the feed itself at https://nuget.org/api/v2/curated-feeds/windows8-packages/Packages. The feed contains packages that are known to work well for Windows Store apps built using XAML or JavaScript.

Within Visual Studio Express 2012 for Windows 8, the NuGet client is configured to point to the curated feed as its default source (though you can switch back to the non-filtered feed if you want to). To download packages from NuGet:

  1. Open a Windows Store app project.
  2. In the Solution Explorer, right-click on the name of your project and choose the Manage NuGet Packages > Menu item.

Now you’ll see the following dialog; from here you can search for packages via the search field, or browse the list of all packages. When you find a package you want to install in your project, click the Install button next to the package name.

image

Adding the Windows 8 Packages feed to other editions of Visual Studio 2012

If you’re using Visual Studio 2012 Professional, Premium, or Ultimate you’ll notice that the Windows 8 Packages feed isn’t included by default. If you’d like to add it, just do the following:

  1. Choose the Tools | Library Package Manager | Package Manager Settings menu
  2. Go in to Package Sources
  3. In the Name field, enter: “Windows 8 package source”
  4. In the Source field, use the following URL: https://nuget.org/api/v2/curated-feeds/windows8-packages/
  5. Click Add to add this feed to the list of package sources

image

Now, with a project open, right-click on the project name and choose Manage NuGet Packages… and you’ll see the Windows 8 package source as an option under the Online category.

Getting your packages into the feed

Because we want to ensure that the Windows 8 filtered feed is quickly up to date in terms of the packages contained, we have a very lightweight inspection/approval process for including packages into the feed.  The process works as follows:

  1. Create NuGet packages in the same manner that you always have (you can find instructions in the nuget.org Creating and Publishing a Package article)
  2. Add one of the tags that we monitor for: winrt, windows8, win8, or winjs
  3. Upload your package using the standard NuGet push command
  4. Your package will then be immediately available in the Windows 8 packages feed

Let’s go!

We’re really excited about integrating NuGet and the NuGet community into the Windows 8 application development experience and hope that you are as well.  Moving forward, there are a couple different areas where we would love to see you get involved:

  • Use existing NuGet packages as a part of designing and developing your Windows Store apps and let us know how it goes.  We’re always interested in knowing how we can improve the experience and your feedback is critical.  You can report errors and suggestions at http://bit.ly/newnugetissue.
  • Create and publish your own NuGet packages that target Windows Store apps.  At the end of the day, the overall health of the Windows 8 developer ecosystem will be determined by you!
  • So whether it’s by providing feedback or creating new libraries, get involved with helping to improve the development experience for building rich, immersive applications for Windows 8!

 

clip_image002Howard Dierking – Program Manager, Web Platform & Tools team

Short Bio: Howard joined the Web Platform & Tools team in 2011 after having previously worked on WCF and serving as Editor-in-Chief for MSDN Magazine. He is currently the Program Manager for NuGet and for the Web optimization framework.

0 comments

Discussion is closed.

Feedback usabilla icon