Problems with building when using NuGet Automatic Package Restore

I recently switched my Visual Studio solution from using NuGet MSBuild based Restore to NuGet Automatic Package Restore as outlined in this article: https://docs.nuget.org/consume/package-restore

Unfortunately, every time I add a new NuGet package to any one of my projects, my TeamCity build inevitably fails!

As many times as I build it on my local machine, it always restores the packages successfully and builds fine.  It just continues to fail on the TeamCity Build server.

The only remedy I have found for this has been to open the Solution on the TeamCity Build Server and build it at least once on the Build Server itself.

Once I do that, it seems to resolve my NuGet Package issues.

However, I would like to avoid doing that everytime I need to add or update a NuGet Package to one or more of my projects in the solution.

Is there a better way to do this?  Do I still have to use the NuGet TeamCity Build Runner even with the NuGet Automatic Package Restore feature built into later release of NuGet with Visual Studio?

Please advise.

Thanks.

1 comment
Comment actions Permalink

Hi Samir,

What TeamCity and NuGet versions do you use? Have you configured 'NuGet Feed Credentials' build feature as described here?
Also please check that Basic HTTP is added into the list of Authentication Modules in TeamCity Settings: Administration > Authentication.
What messages do you see in the build log when the build fails?

0

Please sign in to leave a comment.