3

Is it possible to use paket having no connection to Nuget repository? We have our nuget repository where we store all necessary libs. We use paket to fetch it. Everything works fine while we are working under our company network or using vpn. However paket fails to reach our nuget repository outside our network. No doubts, this behavior is expected.

At the same time I noticed that paket tries to fetch packages from local nuget cache (%userprofile%.nuget) first. The desired behavior is to work directly with nuget local cache if there is no connection to original nuget repository and to throw just warning about it, not an error (throw an error only if there is no required package in cache). Is it possible or such functionality is not provided (yet)? As I know Nuget doesn't crash build if it can get packages from the local cache without connection to repository. Thanks

UPD Howto disable nuget machine-wide cache? - that is not what I want. Nuget itself works fine, the question is about paket.exe

Community
  • 1
  • 1
  • Possible duplicate of [Howto disable nuget machine-wide cache?](http://stackoverflow.com/questions/31557893/howto-disable-nuget-machine-wide-cache) – GSerg Nov 02 '16 at 08:50
  • Have you read this section: Paket - Additional Caches https://fsprojects.github.io/Paket/caches.html – Kiliman Nov 02 '16 at 12:35
  • 1
    @Kiliman this is exactly what I need! Thanks! Have no idea how I couldn't notice this page in documentation... – Ihar Bandarenka Nov 04 '16 at 09:18
  • Maybe [paket.local](http://fsprojects.github.io/Paket/local-file.html) is a better way nowadays. – magicmonty Jan 06 '17 at 21:01

2 Answers2

1

NuGet cache is folder mostly located in Users\{CurrentUser}\Local\NuGet\Cache and stores data from network searches and downloaded packages before they're copied into your packages folder.

What you're probably looking for is local repository, e.g. any folder available in your filesystem. You can even combine it with network repositories and so it will work both online and offline.

paket.dependencies content:

source C:\MyLocalFeed
source \\my.domain\networkFolderFeed
source source https://nuget.org/api/v2 

There are no further requirements on structure of folder you're going to use as repository. Only thing you need is to place there your *.nupkg files.

Jaroslav Kadlec
  • 2,505
  • 4
  • 32
  • 43
0

I just have a hard time making paket to work offline, so I think this question deserves an answer.

At the same time I noticed that paket tries to fetch packages from local nuget cache (%userprofile%.nuget) first

Your observation is correct. From my experience, just put the requested libs in %USERPROFILE%/.nuget/packages, then do a .paket\paket.exe restore. It will work.

Do note that we need to use Nuget packages; eg: copied from another computer .nuget folder, or generated when you are connected. DO NOT copy paket packages folder because it won't work.

Hoàng Long
  • 10,746
  • 20
  • 75
  • 124