如何将自定义 nuget 提要添加到 TeamCity 构建?

How to add the custom nuget feed to TeamCity build?(如何将自定义 nuget 提要添加到 TeamCity 构建?)
本文介绍了如何将自定义 nuget 提要添加到 TeamCity 构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Teamcity(在 Internet 的虚拟机上运行)创建了一个 Nuget 服务器,并创建了将包发布到其中的构建.

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.

我还有另一个项目需要使用该包.这个项目也是建立在 teamcity 之上的.在我本地的 Visual Studio 上,我添加了 nuget feed uri,安装了包,一切正常.但是当我尝试在 teamcity 上构建它时,它说找不到包".

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".

所以我的问题是:如何将自定义 nuget 提要添加到 TeamCity 构建中?"

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

推荐答案

NuGet 包源是通过 Visual Studio 配置的,但它们存储在每个用户的配置文件中,位于 c:Users$USERAppDataRoamingNuGetNuGet.config.TeamCity 包源的条目需要添加到运行构建的构建代理用户的配置文件中.

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. 在您的本地计算机上,为您的用户打开 Nuget.config 文件
  2. 将 TeamCity 包源的条目复制到剪贴板
  3. 在构建代理上,为正在执行 TeamCity 构建的用户打开 NuGet.config 文件
  4. 粘贴到 TeamCity 包源条目中.保存&退出.
  5. 再次运行构建.它现在应该可以找到包了.

ladenedge 记录了我最初回答这个问题时不存在的一个很好的解决方案.如果您没有构建代理的管理员访问权限或想要基于每个项目配置包源,则该解决方案特别有用.

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.

这篇关于如何将自定义 nuget 提要添加到 TeamCity 构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)