2

I am currently switching our builds from Cruise Control to Team City and am encountering an issue trying to restore my custom NuGet package for a component that is used across several of my projects. The component is called Connector Base. I have a build set up in Team City for Connector Base that successfully creates a NuGet package and saves it as an artifact to be accessed from my Team City NuGet server that I have set up. I've gone into the solution of my project that needs to access this dependency and I've installed Connector Base from the NuGet Package Manager using the URL provided me in my Team City settings. All is well and it builds and functions as expected. I then commit it to SVN and attempt to do a NuGet Package Restore on my solution file using the NuGet Installer build step in Team City. The result is that it does not build or restore any packages and so fails the build later on since it can't find the Connector Base dependency. I've looked all over the internet and the closest thing I can find to an answer is here: http://nuget.codeplex.com/discussions/288024. But this is referring to the package creation and not restore.

I am including my logs for reference:

Step 1/6: NuGet Package Restore (NuGet Installer)
[12:09:00]scan: Searching for nuget.config files
[12:09:00]Found packages folder: C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\packages
[12:09:00]Failed to find repositories.config at C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\packages\repositories.config
[12:09:00]Scanning projects in solution file: C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\Acris.sln
[12:09:00]Found project C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\Acris\Acris.csproj
[12:09:00]Found project C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\IngeoCommon\IngeoLogger\IngeoLogger\IngeoLogger.csproj
[12:09:00]Found project C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\Common_Components\DynamicConnectorTester\DynamicConnectorTester.csproj
[12:09:00]Found project C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\Common_Components\Interface\Interface.csproj
[12:09:00]Found project C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\.nuget
[12:09:00]restore: Restoring NuGet packages for Ingeo\Connector_County\NewConnectors\Acris\Acris.sln
[12:09:00]NuGet command: C:\TeamCity\buildAgent\plugins\nuget-agent\bin\JetBrains.TeamCity.NuGetRunner.exe C:\TeamCity\buildAgent\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe restore C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\Acris.sln -Source https://nuget.org/api/v2/ -Source http://localhost/guestAuth/app/nuget/v1/FeedService.svc/
[12:09:00]Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script1470188724716953938.cmd
[12:09:00]in directory: C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris
[12:09:01]JetBrains TeamCity NuGet Runner 8.0.30168.9
[12:09:01]Registered additional extensions from paths: C:\TeamCity\buildAgent\plugins\nuget-agent\bin\plugins-2.8
[12:09:01]Starting NuGet.exe 2.8.50506.491 from C:\TeamCity\buildAgent\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe
[12:09:01]Process exited with code 0

After I do the Package Restore step I attempt to build the solution and it fails with the following error:

"This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them"

For one, I do not want to have to go and physically enable package restore on the build server every time I do a build, nor is it terribly practical to check in my .nuget folder when a simple package restore should do the trick. Does anyone have any experience with this? One thing I read seemed to indicate that it was due to the fact that my Connector Base NuGet package also had dependencies on other non custom NuGet packages. Any help is greatly appreciated.

UPDATE

Here is the error I get even after I was able to get my packages to restore:

[Error] C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\Acris\Acris.csproj(327, 5): This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\TeamCity\buildAgent\work\e0174164dde3f938\Ingeo\Connector_County\NewConnectors\Acris\\.nuget\NuGet.targets.
UberNerd1.0
  • 123
  • 2
  • 11
  • The project with the dependency on my NuGet package did not previously have any NuGet packages installed to it. This means that the packages.config file had not been added to SVN. Once I committed the packages.config it was able to restore those packages. However, I still get the error in the UPDATE above. – UberNerd1.0 Aug 12 '14 at 20:09

1 Answers1

1

Edit the build configuration and add a new parameter of type environment variable called EnableNuGetPackageRestore with value true. This will allow the packages to restore regardless of which agent runs the build.

After enabling package restore on TeamCity, load your solution locally and right click on the solution in the solution explorer and select 'Enable NuGet package restore'. This will change every project in the solution to import the NuGet.targets MsBuild task and you will need to commit this change in to source control.

infojolt
  • 5,244
  • 3
  • 40
  • 82
  • After adding this environment variable parameter and setting it to true, I am still experiencing the same error. – UberNerd1.0 Aug 13 '14 at 17:02
  • I've edited my answer to add in another step you need to perform. After this it should work. – infojolt Aug 15 '14 at 10:51
  • This is something I was already doing previously. We have to 'Enable NuGet package restore' on all of our solutions before they will work when pulled down from SVN. It still has the same problem. – UberNerd1.0 Aug 18 '14 at 21:23