I have an automated build process that I\'d like to extend so I can build the libraries I am distributing via NuGet. Currently, running nuget.exe to create the packages is
I'm doing the thing you want to achieve already in my current project:
Every assembly is built into its own proper nuget package, with dependencies in place.
I solved it by making a package folder in the project for which I wanted to make a nuget package. There I configure a nuspec file with the necessary information about the nupkg
There I make all the folders and unchanging files in there needed for Nuget package structure.
I added a post build step in the project that copies the files that just have been built into the package folder and run nuget.exe
So it goes:
nuget.exe
with nuspec file in package folder.Nuget.exe has to be either in a fixed folder on your system and the buildserver (dirty solution) or included in your build (less dirty).
Buildscript:
Xcopy.exe /Y "$(TargetPath)" "$(ProjectDir)\Package\Lib"
cd "$(ProjectDir)Package"
"$(TargetDir)..\Buildscripts\Nuget.exe" pack MyPackage.nuspec xcopy /Y *.nupkg "$(TargetDir)"
In order to use this, the only thing you have to take care of, is deciding where to checkin the nuget.exe. I made a buildscripts folder on the top level of my development tree.
Install the NuGet Powertools package in your sln and it will add a build target for creating the nupkg then just modify your CI to run that task as well. http://nuget.org/packages/NuGetPowerTools
If you're in a TFS 2010 environment, the NuGetter project should solve the problem of creating nuget packages automatically. It creates one package for the entire build. It is in fact a TFS 2010 build workflow that does the job by calling nuget.exe with some arguments.