Question

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 ?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top