.net - NuGet 包还原找不到包,没有源

标签 .net msbuild teamcity nuget

我的 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/

相关文章:

.net - 使用 WIX 时删除单元测试 dll 文件

continuous-integration - TeamCity Agent 的环境路径为 "lost"

.net - 密码是否使用 DirectoryEntry 安全传输

c# - 错误 MCG0004 :InternalAssert Assert Failed when building UWP app in release mode

ios - Xamarin iOS MSBuild - 缺少 OutputPath?

git - 强制执行代码审查并保持集成分支原始状态的工作流(git、Stash、TeamCity)

visual-studio-2008 - Team City 6.5.5 - MSBuild 问题

.net - 使用 Winform 绘图

c# - 具有多个存储库和服务的 .NET MVC Controller ?

c# - NServiceBus - 类型未在序列化程序中注册 - 修复?