.net - TeamCity 不从特定包源恢复 NuGet 包

标签 .net sitecore nuget teamcity nuget-package-restore

我最近从他们的新 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 安装程序”构建步骤中修改了包源列表,以便 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 Settings

我建议您不要在 TeamCity 中指定包源,而是使用 Nuget.config .sln 文件旁边的文件。这也意味着每个开发人员不需要在 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>

您可以在这篇关于 The right way to restore NuGet packages 的博文中找到更多详细信息。 .

关于.net - TeamCity 不从特定包源恢复 NuGet 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40362250/

相关文章:

C# - 代码契约(Contract) - 检测到的表达式语句评估潜在的副作用

c# - 添加对 netstandard 2.0 的引用的问题

indexing - Sitecore solr索引重建和刷新之间的区别

powershell - 尝试使用 Powershell 安装 Sysinternals 时的警告

c# - 类库的 app.config 中的绑定(bind)重定向有什么作用吗?

.net - 如何使用 Windows 命令行上的命令行将 C++ 文件编译为单个文件

c# - 如何对 Azure 存储表行键和分区键进行编码?

Sitecore ItemWebApi - "Access to site is not granted"

sitecore - Sitecore.Security.AntiCsrf 有什么作用,我可以在我的内容交付服务器上禁用它吗

msbuild - 便携库导致: Found conflicts between different versions of the same dependent assembly that could not be resolved