[英]NuGet Package Restore cannot find package, has no Source
我在TeamCity构建的TeamCity NuGet提要上有一个包,但是一个依赖的TC项目在包恢复期间无法看到它。
[14:05:02] [Exec] E:\\ TeamCity-BuildAgent \\ work \\ 62023563850993a7 \\ Web.nuget \\ nuget.targets(88,9):无法找到“MarkLogicManager40”软件包的版本“1.0.17.0”。
[14:05:02] [Exec] E:\\ TeamCity-BuildAgent \\ work \\ 62023563850993a7 \\ Web.nuget \\ nuget.targets(88,9):error MSB3073:命令“”E:\\ TeamCity-BuildAgent \\ work \\ 62023563850993a7 \\ Web.nuget \\ nuget.exe“install”E:\\ TeamCity-BuildAgent \\ work \\ 62023563850993a7 \\ ProductMvc \\ packages.config“-source”“ - RequestConsent -solutionDir”E:\\ TeamCity-BuildAgent \\ work \\ 62023563850993a7 \\ Web \\“”退出代码1。
请注意,NuGet命令行中的source
参数为空。 这可能是原因吗?
截至今天,NuGet.targets有以下方式指定自定义Feed:
<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>
显然,NuGet自定义源不是通过解决方案或项目文件中的任何内容设置的,或者是解决方案中的nuget.config,而是设置在开发人员配置文件中的nuget.config中。
在TeamCity上,代理不会检查此配置文件或写入它,以确保它包含TeamCity服务器本身的源。
因此,使用自定义TC Feed的TC恢复包不会“正常工作”。 您必须浪费数百磅的客户资金追逐您的尾巴以发现所有这些,然后将您的配置文件中的nuget.config设置/复制到运行构建代理的用户帐户的配置文件中。
可怕。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.