3

I have recently setup a shared drive to act serve as my private Nuget repository.

I wish to push ALL nupkg files from my packages directory to my shared drive.

I managed to figure out this command:

  nuget.exe push ..\packages -source c:\testme

Now although this should work, under my packages directory each nupkg file is in its own directory, so it appears not to be searching recursive, I tried a -s and /s hoping this would work but nothing.

It produces the following error:

     File does not exist (..\packages).

I do see all my nupkg files under my packages directory in my VS solution so I wish to push them to my private repo.

I don't want to have to do the following for each file.

  nuget.exe push -source c:\testme ..\packages\Antlr.Unofficial.3.4.1.0\Antlr.Unofficial.3.4.1.0.nupkg

Is there a better way ?

halfer
  • 19,824
  • 17
  • 99
  • 186
Martin
  • 23,844
  • 55
  • 201
  • 327
  • I also noticed there is a powershell script to mirror nuget.org on my private repo, this is not really want I want, probably too many packages. I just want to PUSH the packages that I am using. Also when I add a new package be able to sync it would be nice. – Martin Apr 09 '14 at 11:53

1 Answers1

4

I use a simple batch file to copy all my referenced packages to a shared folder.

--- syncnuget.bat ---

for /f "usebackq tokens=*" %%n in (`dir /b /s packages\*.nupkg`) do copy "%%n" C:\Path\To\Repository /y

Just run this batch file from your solution root.

It's always a good idea to have a local copy of all your packages since as we've recently seen, there are times when NuGet goes down which could impact development or continuous builds.

Kiliman
  • 18,460
  • 3
  • 39
  • 38