Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have created a Nuget Server using Teamcity (running on a virtual machine in internet) and created the build that publishes a package into it.

I also have another project that needs to use that package. This project is built on teamcity as well. On my local Visual Studio I added the nuget feed uri, installed the package and everything works fine. But when I try to build it on teamcity it says that "Package not found".

So my question is : "How to add the custom nuget feed to TeamCity build?"

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
445 views
Welcome To Ask or Share your Answers For Others

1 Answer

The NuGet package sources are configured through Visual Studio, but they're stored in a per-user configuration file, found at c:Users$USERAppDataRoamingNuGetNuGet.config. The entry for the TeamCity package source needs to be added to the config file of the build agent user that's running your builds.

  1. On your local machine, open the Nuget.config file for your user
  2. Copy the entry for the TeamCity package source to the clipboard
  3. On the build agent, open the NuGet.config file for the user that's executing your TeamCity builds
  4. Paste in the TeamCity package source entry. Save & quit.
  5. Run the build again. It should now be able to find the package.

EDIT: ladenedge documents a good solution that didn't exist when I originally answered this question. The solution is especially useful if you don't have admin access to the build agent or want to configure package sources on a per-project basis.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...