Tuesday, October 7, 2014

Install NuGet Packages Offline - Visual Studio

Problem:
You are offline and trying to create a VS project with NuGet Package dependencies.
The challenge is how to get them.

Solution:

Use the cached copies on your machine stored at, %LOCALAPPDATA%\NuGet\Cache.

1.) Start Visual Studio and Open the package manager
  • Tools > NuGet Package Manager > Package Manager Settings
  • Select Package Sources in left hand menu
2.) Add Cache package to package manager.
  • Above the Available Package Sources window are 4 icons
  • Select the + and this will add a new source
  • Highlight the new entry
  • Edit the Name field, provide a name of your choosing
  • Source field add full path to the NuGet Cache
    • Find it by opening a  windows explorer window and typing the path, %LOCALAPPDATA%\NuGet\Cache
    • This will resolve to the path to your local cache
  • Select Update
3.) Your Done.

WARNING: Realize that this is only valid until you clear your nuget cache.

Source:
http://nuget-offline.blogspot.com/#!

No comments:

Post a Comment