Using Nuget for CI process and TFS build workflow ... trying to get the binaries

Aug 11, 2011 at 8:23 PM

I'm using Team Build and have a build definition that builds both debug and release configurations and places the build output in the Binaries folder which is parallel to the Sources root folder. The build definition template does not place the code into bin/<configuration> folders under the folder that contains the source .csproj file. 

Is there a way for me to point the nuget.exe command to look in the Binaries folder instead of the bin subfolder under the project folder?

Right now I execute:    nuget pack x.csprog -Prop Configuration=Release
Can I add a parameter like:    nuget pack x.csprog -src c:\Build\17\BuildDefinition\Binaries -Prop Configuration=Release

Thanks, Eric

Aug 11, 2011 at 10:18 PM

Try this:

nuget pack x.csproj /p Configuration=Release;TargetPath=c:\Build\17\BuildDefinition\Binaries

Aug 12, 2011 at 1:03 PM

Running the following command produces an error:

C:\windows\nuget.exe pack s.csproj -Prop TargetPath=C:\Builds\17\MagellanAlpha\CI_Core_v2.2\Binaries

Attempting to build package from 'x.csproj'. Unable to find 'C:\Builds\17\MagellanAlpha\CI_Core_v2.2\Binaries'. Make sure the project has been built.

The folder debug is fully populated with the build output. included the .dll generated by the project file x.csproj.

Aug 12, 2011 at 4:41 PM

Ah my bad, it expects target path to be the file name.

Aug 13, 2011 at 3:29 PM
Edited Aug 22, 2011 at 7:53 PM

Not sure if this is in line with the nature of this question or not but here is the post build event settings i'm using to get my project related binaries to include the nuget package generation as part of the dev wks and tfs automated build processing.  The rem if /i "$(IsBuildMachineBuild)" == "true" statement can be uncommented to have it only occur during tfs automated build processing.

echo processing post build events for sn=$(SolutionName) pn=$(ProjectName) cn=$(ConfigurationName) bt=$(BuildTarget)
echo relevant properties cn=$(computername) pa=$(processor_architecture) ibmb=$(IsBuildMachineBuild)
echo relevant directories sd=$(SolutionDir) pd=$(ProjectDir)
echo relevant directories td=$(TargetDir) od=$(OutDir)
echo relevant directories cd=%cd% msb=$(MSBuildBinPath) pf=%programfiles% wd=%windir%
for /d %%i in ( . ) do ( set TargetWoSpacesDir=%%~si\)
echo TargetWoSpacesDir=%TargetWoSpacesDir%
rem if /i "$(IsBuildMachineBuild)" == "true" (
  robocopy "$(ProjectDir)NuGet" .\NuGet /mir /r:0
  robocopy . .\NuGet\Lib\<libtype> $(TargetName).* SomeAdditionalAssemblyDepedency.* /r:0
  set ProjectDirWoTrailingSlash=$(ProjectDir)
  set ProjectDirWoTrailingSlash=%ProjectDirWoTrailingSlash:~0,-1%
  robocopy "%ProjectDirWoTrailingSlash%" .\NuGet\Src\$(ProjectName) *.cs /s /xd Bin obj NuGet ServiceReferences /r:0
  robocopy "$(ProjectDir)obj" .\NuGet\Src\$(ProjectName)\obj *.g.cs /s /r:0
  robocopy "$(SolutionDir)IdentityModel.Phone" .\NuGet\Src\IdentityModel.Phone *.cs /s /xd Bin obj ServiceReferences /r:0
  robocopy "$(SolutionDir)IdentityModel.Phone\obj" .\NuGet\Src\IdentityModel.Phone\obj *.cs /s /r:0
  nuget pack .\Nuget\Package.nuspec -Symbols
rem )
rem note1 - this requires setting a < tfs project > | builds | < build definition > | process | advanced | msbuild arguments entry "/p:IsBuildMachineBuild=true"
rem note2 - change "$(IsBuildMachineBuild)" == "true" -> "" to debug this post build event processing using localhost ide build