NuGet 包还原找不到包,没有源

NuGet Package Restore cannot find package, has no Source(NuGet 包还原找不到包,没有源)
本文介绍了NuGet 包还原找不到包,没有源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我的 TeamCity NuGet 源中有一个包,由 TeamCity 构建,但依赖的 TC 项目在包还原期间看不到它.

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-BuildAgentwork62023563850993a7Web.nuget uget.targets(88, 9):找不到包MarkLogicManager40"的版本1.0.17.0"'.

[14:05:02][Exec] E:TeamCity-BuildAgentwork62023563850993a7Web.nuget uget.targets(88, 9): Unable to find version '1.0.17.0' of package 'MarkLogicManager40'.

[14:05:02][Exec] E:TeamCity-BuildAgentwork62023563850993a7Web.nuget uget.targets(88, 9):错误 MSB3073:命令"E:TeamCity-BuildAgentwork62023563850993a7Web.nuget uget.exe"安装E:TeamCity-BuildAgentwork62023563850993a7ProductMvcpackages.config"-来源"-RequireConsent -solutionDir E:TeamCity-BuildAgentwork62023563850993a7Web"以代码 1 退出.

[14:05:02][Exec] E:TeamCity-BuildAgentwork62023563850993a7Web.nuget uget.targets(88, 9): error MSB3073: The command ""E:TeamCity-BuildAgentwork62023563850993a7Web.nuget uget.exe" install "E:TeamCity-BuildAgentwork62023563850993a7ProductMvcpackages.config" -source "" -RequireConsent -solutionDir "E:TeamCity-BuildAgentwork62023563850993a7Web "" exited with code 1.

请注意,NuGet 命令行中的 source 参数为空.会不会是这个原因?

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

推荐答案

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

As of today, NuGet.targets has the following way to specify custom feed(s):

<ItemGroup Condition=" '$(PackageSources)' == '' ">
    <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%NuGetNuGet.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 放在解决方案文件旁边:

Another option is to put NuGet.config next to the solution file:

<?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 包还原找不到包,没有源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

MSBuild cannot find a reference(MSBuild 找不到参考)
The reference assemblies for framework .NETCore, Version=v5.0 were not found(未找到框架 .NETCore,Version=v5.0 的参考程序集)
quot;File has a different computed hash than specified in manifestquot; error when signing the EXE(“文件的计算哈希值与清单中指定的不同签署EXE时出错)
Good-practices: How to reuse .csproj and .sln files to create your MSBuild script for CI?(良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 MSBuild 脚本?)
Run an MSBuild target only if project is actually built(仅在实际构建项目时运行 MSBuild 目标)
MS-Build BeforeBuild not firing(MS-Build BeforeBuild 未触发)