This project has moved. For the latest updates, please go here.

Push multiple projects to NuGet using Batch/CMD script

Sep 21, 2015 at 8:49 AM
Let me start by thanking you for this great utility. It will be a time saver going forward.

I am trying to configure a batch push as I have several NuGet projects that need to stay in sync and be published together. What I am trying is this:
@ECHO OFF

cd PATH_TO_MY_PROJECT\_CreateNewNuGetPackage
call RunMeToUploadNuGetPackage.cmd
cd ..\..

cd PATH_TO_MY_SECOND_PROJECT\_CreateNewNuGetPackage
call RunMeToUploadNuGetPackage.cmd
cd ..\..
My problem is that each time I call the RunMeToUploadNuGetPackage.cmd, it pops up a window asking for the .nupkg file to push. Is there a way to automate this so that it pushes the last one that was built or similar?

I am willing to modify my environment as needed to make this easier, such as ensuring all other .nupkg files are removed as a pre-build step or similar.

Thanks in advance for any suggestions and assistance.
Coordinator
Sep 21, 2015 at 11:42 PM
You can call the New-NuGetPackage.ps1 script directly yourself and pass in the appropriate parameters (such as the location of the .nupkg file to upload). As for determining which .nupkg file to pass in, it will be up to you to code the logic to determine which one to grab. Also, because there will be a little bit of logic there, you might want to consider using PowerShell instead of a batch file, as it will be much easier to code the logic to determine which .nupkg file to grab.


.EXAMPLE
& New-NuGetPackage.ps1 -PackageFilePath "C:\Some Folder\MyPackage.nupkg"

Push the existing "MyPackage.nupkg" file to the NuGet gallery.
User will be prompted to confirm that they want to push the package; to avoid this prompt supply the -PushPackageToNuGetGallery switch.
Sep 22, 2015 at 9:00 AM
That should work perfectly. Thanks for the quick response. :)