Using Multiple Package Sources with CI Build

Jan 25, 2012 at 11:11 PM

I have a CI server setup using just TFS Build with an existing solution that has been building fine.
I recently updated it to use Nuget for many common libraries such as EntLib, etc.  Works fine.

Now I have setup a local Nuget server which I reference a package from.
When I run the solution through the CI process, a set of unit tests fail because they cannot find this reference.
I'm 99.9% sure this is simply because my build server does not have the package source configured for it.

I logged onto the build server and added the package source via TFS (under my user account).
My CI build runs under a different user (which I do not have the user/password for).

So, my questions is; where are the package source configurations saved?
Or, what do I need to do in order fo rmy build server to recognize my local nuget feed.


Jan 25, 2012 at 11:44 PM

By default, config files are stored under %LocalAppData%\NuGet. I'm assuming you have Enable Package Restore \ NuGet.PowerTools installed on your machine. You can either specify your sources in the nuget.settings.targets file (property named PackageSources) or by copying your nuget.config file from your machine next to the executable.

Jan 25, 2012 at 11:48 PM

Are you using teamcity's ability to do this?

Jan 26, 2012 at 2:55 PM

Thanks pranavkm, I had not enabled package restore.  Once I did and saw the config/exe it creates in the solution, it became pretty obvious what the next steps are.

Thanks for the help :)

Feb 2, 2012 at 11:15 PM

I am using PackageRestore and am also having problems getting CI to pull packages from my local sources. We are using TeamCity but not the 7.0 EAP. 

Is there any way of getting more details about why the package could not be found?

I have tried two tactics. Edit the NuGet.targets to have all the sources. That was a dead end and created issue #1861

Next I added nuget source via automation before msbuild in hopes that this would set up the source for the current user.

sh "#{NUGET_EXE} sources Add -Name MyCompany -Source #{NUGET_FEED}"

This works great from a command line but not when run from the CI. I get this as a result:

[Execute msbuild] C:\TeamCity\buildAgent\work\6d5a5b62c029bec9\source\.nuget\nuget.targets(43,9): error MSB3073: The command ""C:\TeamCity\buildAgent\work\6d5a5b62c029bec9\source\.nuget\nuget.exe" install "C:\TeamCity\buildAgent\work\6d5a5b62c029bec9\source\Dovetail.SDK.Bootstrap\packages.config" -source "" -o "C:\TeamCity\buildAgent\work\6d5a5b62c029bec9\source\packages"" exited with code 1. 

The source being added is a file share. I have checked file permissions. Any suggestions about what I can do to divine what exactly is failing? Anyone have a similar setup?


Feb 3, 2012 at 3:23 PM

To work around I wrote my own package-restore automation.

Note: I had to turn off Package Restore. To do this I manually removed all the calls from .csproj files. 

FYI had to use a gist because code snippets on CodePlex are not working for Firefox or Chrome :( Insert rant here about collaboration friction and mention of a move to GitHub.