28

I have a package on my TeamCity NuGet feed, built by TeamCity, but a dependent TC project cannot see it during package restore.

[14:05:02][Exec] E:\TeamCity-BuildAgent\work\62023563850993a7\Web.nuget\nuget.targets(88, 9): Unable to find version '1.0.17.0' of package 'MarkLogicManager40'.

[14:05:02][Exec] E:\TeamCity-BuildAgent\work\62023563850993a7\Web.nuget\nuget.targets(88, 9): error MSB3073: The command ""E:\TeamCity-BuildAgent\work\62023563850993a7\Web.nuget\nuget.exe" install "E:\TeamCity-BuildAgent\work\62023563850993a7\ProductMvc\packages.config" -source "" -RequireConsent -solutionDir "E:\TeamCity-BuildAgent\work\62023563850993a7\Web\ "" exited with code 1.

Note that the source parameter in the NuGet command line is empty. Could this be the cause?

4

2 回答 2

43

截至今天,NuGet.targets 有以下方式来指定自定义提要:

<ItemGroup Condition=" '$(PackageSources)' == '' ">
    <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
    <!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->

    <PackageSource Include="https://nuget.org/api/v2/" />
    <PackageSource Include="\\MyShare" />
    <PackageSource Include="http://MyServer/" />
</ItemGroup>

另一种选择是将NuGet.config放在解决方案文件旁边:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
    <add key="MyShare" value="\\MyShare" />
    <add key="MyServer" value="http://MyServer" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)"  />
  </activePackageSource>
</configuration>
于 2013-07-20T00:24:53.193 回答
9

显然,NuGet 自定义提要不是通过解决方案或项目文件中的任何内容或解决方案中的 nuget.config 设置的,而是通过开发人员配置文件中的 nuget.config 设置的。

在 TeamCity 上,该配置文件的代理没有检查或写入它,以确保它包含 TeamCity 服务器本身的提要。

因此,使用自定义 TC 提要在 TC 上恢复包不会“正常工作”。您必须浪费数百英镑的客户资金来追逐您的尾巴以发现所有这些,然后将您的 nuget.config 从您的配置文件设置/复制到运行构建代理的用户帐户的配置文件中。

可怕。

于 2013-06-17T16:35:57.107 回答