簡體   English   中英

TeamCity不從特定包源恢復NuGet包

[英]TeamCity not restoring NuGet packages from particular package source

我最近從他們的新NuGet服務器向我的解決方案添加了一堆Sitecore NuGet包: https//sitecore.myget.org/F/sc-packages/api/v3/index.json

但TeamCity似乎無法下載這些:

[12:45:16][restore] Unable to find version '8.1.160302' of package 'Sitecore.ContentSearch.Linq.NoReferences'.
[12:45:16][restore] Unable to find version '8.1.160302' of package 'Sitecore.ContentSearch.NoReferences'.
[12:45:16][restore] Unable to find version '8.1.160302' of package 'Sitecore.Kernel'.
[12:45:16][restore] Unable to find version '8.1.160302' of package 'Sitecore.Kernel.NoReferences'.

我在“NuGet Installer”構建步驟中修改了包源列表,以便Sitecore源是唯一的,但它仍然無法恢復這些.dll。 (作為旁注:我原本以為其他軟件包現在都會失敗,因為它們的源已被刪除,但那些沒有錯誤?)

查看日志,我可以看到被觸發的命令,看起來是正確的:

C:\TeamCity\buildAgent\tools\NuGet.CommandLine.2.8.6\tools\NuGet.exe restore C:\TeamCity\buildAgent\work\52ce411043f6b04c\MySolution.sln -Source https://sitecore.myget.org/F/sc-packages/api/v3/index.json

您已經引用了Nuget v3提要,但看起來您的TeamCity Nuget安裝程序步驟設置為使用Nuget.exe v2.8.6。 更新設置以使用v3 +:

Nuget設置

我建議您不要在TeamCity中指定Package源,而是使用.sln文件旁邊的Nuget.config文件。 這也意味着每個開發人員不需要在Visual Studio中單獨添加源代碼,也不需要對源列表進行源代碼控制。 TeamCity還將自動將此列表用於包源。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="Sitecore NuGet Feed" value="https://sitecore.myget.org/F/sc-packages/api/v3/index.json" />
    <add key="Custom Server" value="http://my-custom-server.org/api/v3/" />
  </packageSources>
</configuration>

您可以在此博客文章中找到有關恢復NuGet包的正確方法的更多詳細信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM