重试源的“FindPackagesByIdAsync”

问题描述 投票:0回答:1

我有一个

dotnet core
项目,它在本地构建得很好,但多次抛出以下错误:

Retrying 'FindPackagesByIdAsync' for source 'https://mycontrol.pkgs.visualstudio.com/_packaging/f8292c33-blah-blah-blah-e5e14bb9ba87/nuget/v3/flat2/microsoft.net.test.sdk/index.json'.
  Response status code does not indicate success: 401 (Unauthorized).

此错误出现在项目中使用的每个包的 VSTS 构建日志中。

打开链接显示:

{
$id: "1",
innerException: null,
message: "Can't find the package 'microsoft.net.test.sdk' in feed 'MyFeeds'.",
typeName: "Microsoft.VisualStudio.Services.NuGet.WebApi.Exceptions.PackageNotFoundException, Microsoft.VisualStudio.Services.NuGet.WebApi",
typeKey: "PackageNotFoundException",
errorCode: 0,
eventId: 3000
}

虽然我的项目文件夹中没有

NuGet.Config
,但我的父文件夹中有一个:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="_nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="_myget.org" value="https://dotnet.myget.org/F/mstestv2/api/v3/index.json" />
  </packageSources>
</configuration>

我也会收到此错误(但仅限于日志中的 1 或 2 个包):

C:\hostedtoolcache\windows\dotnet\sdk\2.1.701\NuGet.targets(121,5): error : Failed to retrieve information about 'specflow' from remote source 'https://apsourcecontrol.pkgs.visualstudio.com/_packaging/98e0f10f-afcb-4c74-a075-37c564e0408a/nuget/v3/flat2/specflow/index.json'. [D:\a\1\s\Testing\Tester\MsTester\MsTester.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\2.1.701\NuGet.targets(121,5): error :   Response status code does not indicate success: 401 (Unauthorized). [D:\a\1\s\Testing\Tester\MsTester\MsTester.csproj]

如果我收到的应用程序只是第一个错误,则构建成功,但如果我收到 1 个或多个第二个错误,则构建失败。

我需要做什么才能告诉

dotnet core
从哪里获取软件包?

[编辑]我尝试将

NuGet.Config
放入项目文件夹中,但无济于事。

[EDIT-2]我已经可以使用了。解决方案是将

NuGet
源放入
csproj
文件中,如下所述:https://stackoverflow.com/a/56231929/71376

.net-core azure-devops nuget-package-restore build-pipeline
1个回答
0
投票

我也遇到过类似的错误,但是是在本地构建并使用

Retrying 'FindPackagesByIdAsync'
和包
Microsoft.Azure.Functions.Worker.Extensions.DurableTask

构建失败,但即使构建失败,我也能够调试并使 Azure Functions 正常工作。

最后,我只是将该包添加到项目中。奇怪的是,没有对存储库进行 .csproj 更改,因此我相信引用已经存在,但不知何故损坏了。老实说,这部分没有 .csproj 更改,我仍然无法解释......但是构建错误已经消失了。 :)

© www.soinside.com 2019 - 2024. All rights reserved.