如何将自定义 nuget 提要添加到 TeamCity 构建?
- 作者: 情丶深深爱
- 来源: 51数据库
- 2023-02-13
问题描述
我使用 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.
- 在您的本地计算机上,为您的用户打开 Nuget.config 文件
- 将 TeamCity 包源的条目复制到剪贴板
- 在构建代理上,为正在执行 TeamCity 构建的用户打开 NuGet.config 文件
- 粘贴到 TeamCity 包源条目中.保存&退出.
- 再次运行构建.它现在应该可以找到包了.
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 ***** access to the build agent or want to configure package sources on a per-project basis.
- C#通过fleck实现wss协议的WebSocket多人Web实时聊天(附源码)
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源









