Good news: our package sources feature is out of beta after almost a year. The reason for that is that we wanted to make this a very stable feature which it proved to be thanks to many of our users testing it. But… what is this feature?

By default, MyGet uses the official NuGet gallery as the one and only source for packages. Package sources allows us to add additional sources for packages. For example if we want to use Chocolatey as a source for packages, we can add it as a primary or secondary package source. What’s more, we can also push packages from our MyGet feed to the upstream package source.

Package sources list

Let’s dive into some of the capabilities of Package Sources.

Adding a package source

Under the Package Sources tab of our feed, we can click the Add button to create a new package source. We can specify a name and URL to the package source, optionally provide authentication details and an API key for the package source. We can also select a preset package source, for example Chocolatey, a TeamCity server or a list of Windows 8 packages available from NuGet.org.

Add package source

Optionally, we can also provide a filter. Filtering is based on the OData Filtering System. Valid filters are similar to Id eq 'jQuery' or IsLatestVersion eq true and Id ne 'Foo'. If we wanted to only be able to add packages which have the term “javascript” in their description, we can add the following filter: substringof('javascript', Description) eq true.

Throughout the context of your feed, MyGet will use the package sources in an ordered fashion. Reordering package sources to have a different default, for example, can be done by simply dragging items in the list.

Adding packages from another feed

After adding a package source, we can use it when adding packages to our own feed on MyGet.

Add package from another feed

We can select the package source to use from the dropdown and search the selected package source.

Feed proxying

Ever thought about having your own MyGet feed containing your company’s internal libraries and combining them with perhaps a filtered subset of the official NuGet package source? MyGet provides such feature out of the box, built on package sources.

Proxy an upstream package source

When creating or editing a package source, we can tick the “Proxy package source” checkbox:

Proxy feed

Note that also with the feed proxy, filtering the upstream feed is possible. For example, the filter string substringof('wp8', Tags) eq true that we used will filter all upstream packages and only include those where the tags contain “wp8”.

From this point forward when searching packages in Visual Studio, we’ll be able to see our own packages enriched with packages from the official NuGet package source:

Add package from feed

Instead of working with a number of NuGet feeds, your development team will just work with one feed that is aggregating packages from both MyGet and other package sources out there (NuGet, Orchard Gallery, Chocolatey, …). This centralizes managing external packages and makes it easier for your team members to find the packages they can use in your projects. Management of packages that can be used by your team is centralized by this feature.

Push upstream

Each time a team member of your open source or enterprise project commits source code changes, your build server pushes an updated release to this package repository in the form of a prerelease NuGet package. Now what happens if a release to the official NuGet package source has to be created? Typically, you will either create a fresh package which will be the package to release, or download a package from your build server, change the version and upload that one to NuGet.org (or another repository). No need for such bloated process: MyGet will perform the push for you.

The first time you want to push a package to another NuGet feed, you’ll probably have to configure the other feed’s URL and API key to use when pushing there. In the package source, simply make sure to provide an API key and you’re all set to make use of this feature. From the moment a package source has been configured, using the “Push” button will enable you to push packages to another feed.

Push package upstream

After clicking the “Push” button, MyGet will present you with an overview of the package which will be pushed to another feed. Select the feed to which you want to push and verify the other fields. You can also modify the prerelease tag if needed (for example for promoting a prerelease to a stable package version).

Push package from MyGet to NuGet

Click “Push” and MyGet will take care of pushing the package to the selected package source.

Happy packaging!