Mark
Mark

Reputation: 1687

TeamCity Build Server cannot restore nuget packages

Please keep in mind that I am fairly new to the TeamCity platform. :-)

We are using TeamCity to build our projects and have come across an issue where there are several projects which require nuget to restore missing packages.

First clue to this being the issue was the error, "This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them."

I've added a build step and placed it as the first step in the sequence and what now happens is that TeamCity checks 3 places in effort to resolve the packages. The first 2 locations are local to the build server.

A. NuGet\Cache B. packages C. Attempts to connect to https://api.nuget.org/v3/index.json

The packages its trying to restore aren't present on the local build server so it attempts to reference the api.nuget.org repository which constantly fails after timing out with the error:

Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. Unable to connect to the remote server A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.80.127.254:80

I've researched this error and have seen others report the identical issue but haven't been able to find any definitive solution.

Since VS2017 acquires the missing assembly packages from my local environment when applicable the packages directory included within the Project solution.

And because when a check-in is performed via TFS, the folders and files are copied (referenced) on the build server.

Shouldn't there be some way to direct TeamCity to include the packages directory which is also checked in?

Otherwise, what other alternatives are there to circumvent when TeamCity wants to perform a package restore when the packages directory doesn't exist on the build server and all searched locations fail?

** I don't believe this is a duplicate question but if so, kindly refer me to the appropriate link **

Thx

Upvotes: 0

Views: 2464

Answers (1)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30362

Generally when the changes are checked in the solution/project files will be updated automatically. So the dependencies will also be updated, basically we just need to add the Nuget Resore step to restore the packages for the solution.

In you scenario, please check if you have set the proxy. If it is, then you need to add proxy settings into Nuget.Config file. Refer to this link for details: Nuget Config Section & Nuget Proxy Settings.

Alternatively you can download the needed packages from nuget to a shared directory then add to Nuget.config as the source.

Reference:

Also check if this thread helps: Please enable auto "Enable auto assign public IP" in VPC settings.

Upvotes: 1

Related Questions