我的 TeamCity NuGet 提要中有一个由 TeamCity 构建的包,但在包还原期间,依赖的 TC 项目看不到它。
[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.
请注意
source
NuGet 命令行中的参数为空。这可能是原因吗?
最佳答案
截至今天,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>
关于.net - NuGet 包还原找不到包,没有源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17151709/