Creating a NuGet package from TFS 2010 Build

Jan 11, 2012 at 7:33 PM

Hi Folks..,

I'm using NuGet 1.6 and Team Foundation Server Build 2010.

I used the 'Enable NuGet Package Restore' command to get the nuget.exe and target files into my project. I noticed that the target file had a BuildPackage target and decided to give it a shot. Unfortunately I get an error when I try to use it through Team Foundation Server build (it works fine locally):

BuildPackage:
  "C:\Builds\2\Lync Server\Lync Framework Release\Sources\.nuget\nuget.exe" pack "C:\Builds\2\Lync Server\Lync Framework Release\Sources\Cco.Ocs.Framework\Cco.Lync.Framework.csproj" -p Configuration=Release -o "C:\Builds\2\Lync Server\Lync Framework Release\Binaries" -symbols
  Attempting to build package from 'Cco.Lync.Framework.csproj'.
C:\Builds\2\Lync Server\Lync Framework Release\Sources\.nuget\nuget.targets(49,9): error : The imported project "C:\Builds\2\Lync Server\Lync Framework Release\Source\.nuget\nuget.targets" was not found. Confirm that the path in the  declaration is correct, and that the file exists on disk.  C:\Builds\2\Lync Server\Lync Framework Release\Sources\Cco.Ocs.Framework\Cco.Lync.Framework.csproj [C:\Builds\2\Lync Server\Lync Framework Release\Sources\Cco.Ocs.Framework\Cco.Lync.Framework.csproj]
C:\Builds\2\Lync Server\Lync Framework Release\Sources\.nuget\nuget.targets(49,9): error MSB3073: The command ""C:\Builds\2\Lync Server\Lync Framework Release\Sources\.nuget\nuget.exe" pack "C:\Builds\2\Lync Server\Lync Framework Release\Sources\Cco.Ocs.Framework\Cco.Lync.Framework.csproj" -p Configuration=Release -o "C:\Builds\2\Lync Server\Lync Framework Release\Binaries" -symbols" exited with code 1. [C:\Builds\2\Lync Server\Lync Framework Release\Sources\Cco.Ocs.Framework\Cco.Lync.Framework.csproj]

What I notice here is that in the first error line, the path "c:\Builds\2\Lync Server\Lync Framework Release\Sources" has changed to "c:\builds\2\Lync Server\Lync Framework Release\Source", (the 'source' path is valid on my local dev machine, but 'sources' is the valid path on the build machine) judging from the csproj file, this is due to SolutionDir being undefined (in which case, it defaults to 'source'). Given that the NuGet pack command looks to be correct, why does it care at that point about re-parsing the project file.

Can anyone offer any solutions for this problem?

Thanks

James Carscadden

Jan 27, 2012 at 9:25 PM

I got past that point by modifying the workspace of the build definition, not sure if you have the same issue.  something to do with my build agent folder being set to "$(SourceDir)" instead of looking pretty much the same as the Source Control Folder it was associated to.

Of course after that I start getting errors that it can't find the dll file created anyway as it's looking in the bin directory and tfs seems to be creating it in the obj directory.  So i didn't really get very far anyway.