Many teams like to make MyGet the only feed that they use. Developers can upload their own packages to that hosted feed and consume them from Visual Studio or a build server. MyGet can also proxy search results and packages from an upstream package source, making management of feeds in a team much easier.
Package sources play a key role in this scenario. By default, the NuGet Gallery is configured as an upstream package source from which packages can be added explicitly. However using the package proxy feature, search results and packages from upstream sources can be automatically mirrored to your feed.
As you can imagine, using this feature yields some benefits:
First of all, we'll have to configure a package source for our MyGet feed. Navigate to the feed settings and browse the Package Sources tab. Then click Add Package Source.
A dialog will prompt us for package source information and will also expose a few common presets we can take advantage of.
We can use one of the presets that are available, as well as enter information for the feed we want to proxy, perhaps a TeamCity feed or similar. We can also specify an optional filter (to only include packages matching given criteria) and authentication information in case we're proxying a private feed.
At the bottom of the Add Package Source dialog, we can specify two additional options:
These options will do the following:
Include packages from the package source in search results: the upstream package source will be searched and packages that match the search will be displayed when consuming the feed from Visual Studio. Packages from the upstream source can be installed into a project but will be downloaded from the upstream package source.
Automatically add downloaded upstream packages to the current feed: when the above option is enabled, packages that are downloaded will automatically be mirrored on your feed, ensuring the package is available all the time (even when the upstream package source experiences an outage).
Enabling both options will ensure that the MyGet feed is always up-to-date with the packages you are consuming in your organization and that upstream packages are displayed and mirrored on your feed.
Once both aforementioned options are enabled, we can consume our own feed from Visual Studio which will also list upstream packages. For example, the acmecompany feed I've created only lists one package:
When searching in Visual Studio, we do see packages that originate from upstream package sources:
After installing this package, our feed now automatically contains a copy of the jQuery package:
From now on, the package is available from our MyGet feed directly, without having to explicitly add it manually from the upstream package source.