問題描述
我使用 Teamcity(在 Internet 的虛擬機(jī)上運(yùn)行)創(chuàng)建了一個(gè) Nuget 服務(wù)器,并創(chuàng)建了將包發(fā)布到其中的構(gòu)建.
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.
我還有另一個(gè)項(xiàng)目需要使用該包.這個(gè)項(xiàng)目也是建立在 teamcity 之上的.在我本地的 Visual Studio 上,我添加了 nuget feed uri,安裝了包,一切正常.但是當(dāng)我嘗試在 teamcity 上構(gòu)建它時(shí),它說找不到包".
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 構(gòu)建中?"
So my question is : "How to add the custom nuget feed to TeamCity build?"
推薦答案
NuGet 包源是通過 Visual Studio 配置的,但它們存儲在每個(gè)用戶的配置文件中,位于 c:Users$USERAppDataRoamingNuGetNuGet.config
.TeamCity 包源的條目需要添加到運(yùn)行構(gòu)建的構(gòu)建代理用戶的配置文件中.
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.
- 在您的本地計(jì)算機(jī)上,為您的用戶打開 Nuget.config 文件
- 將 TeamCity 包源的條目復(fù)制到剪貼板
- 在構(gòu)建代理上,為正在執(zhí)行 TeamCity 構(gòu)建的用戶打開 NuGet.config 文件
- 粘貼到 TeamCity 包源條目中.保存&退出.
- 再次運(yùn)行構(gòu)建.它現(xiàn)在應(yīng)該可以找到包了.
ladenedge 記錄了我最初回答這個(gè)問題時(shí)不存在的一個(gè)很好的解決方案.如果您沒有構(gòu)建代理的管理員訪問權(quán)限或想要基于每個(gè)項(xiàng)目配置包源,則該解決方案特別有用.
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.
這篇關(guān)于如何將自定義 nuget 提要添加到 TeamCity 構(gòu)建?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!