Integrated NuGet Package Restore
A few months ago the NuGet team released NuGet 2.7, which introduced a new approach to package restore. We recently updated the AppHarbor build process to adopt this approach and integrate the new NuGet
restore command. AppHarbor will now automatically invoke package restore before building your solution.
Automatically restoring packages is a recommended practice, especially because you don’t have to commit the packages to your repository and can keep the footprint small. Until now we’ve recommended using the approach desribed in this blog post to restore NuGet packages when building your application. This has worked relatively well, but it’s also a bit of a hack and has a few caveats:
- Some NuGet packages rely files that needs to be present and imported when MSBuild is invoked. This has most notably been an issue for applications relying on the
Microsoft.Bcl.Buildpackage for the reasons outlined in this article.
NuGet.exehas to be committed and maintained with the repository and project and solution files needs to be configured.
- Package restore can intermittently fail in some cases when multiple projects are built concurrently.
With this release we expect to eliminate these issues and provide a more stable, efficient and streamlined way of handling package restore.
If necessary, NuGet can be configured by adding a
NuGet.config file in the same directory as your solution file (or alternatively in a
.nuget folder under your solution directory). You usually don't have to configure anything if you’re only using the official NuGet feed, but you’ll need to configure your application if it relies on other package sources. You can find an example configuration file which adds a private package source in the knowledge base article about package restore and further documentation for NuGet configuration files can be found here.
If you hit any snags we’re always happy to help on our support forums.