简体   繁体   English

TFS 构建过程无法拉动 nuget package

[英]TFS build process can't pull nuget package

I've set up a pipeline on TFS 16.131.28601.4.我已经在 TFS 16.131.28601.4 上建立了一个管道。 When it gets to the dotnet restore task it tries to pull a package from an internal feed, which is defined in the nuget.config along with the packageSourceCredentials.当它执行 dotnet 恢复任务时,它会尝试从内部提要中提取 package,该提要与 packageSourceCredentials 一起在 nuget.config 中定义。

The error I get when it fails to pull the package is:我在拉 package 失败时得到的错误是:

Restoring packages for .NETCoreApp,Version=v3.1...
Retrying 'FindPackagesByIdAsyncCore' for source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'.
The data is invalid.
Retrying 'FindPackagesByIdAsyncCore' for source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'.
The data is invalid.
1>C:\Program Files\dotnet\sdk\3.1.301\NuGet.targets(128,5): error : Failed to retrieve information about 'xxx.Api.Client' from remote source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'. [D:\Build\agent\_work\5\s\xxx.Api.Client.Tests\xxx.Api.Client.Tests.csproj]
C:\Program Files\dotnet\sdk\3.1.301\NuGet.targets(128,5): error :   The data is invalid. [D:\Build\agent\_work\5\s\xxx.Api.Client.Tests\xxx.Api.Client.Tests.csproj]
NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information about 'xxx.Api.Client' from remote source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'.
---> Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: The data is invalid.

The nuget.config looks like this: nuget.config 如下所示:



<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear /> line below -->
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="xxx" value="http://xx.xxx.xx.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2" />
  </packageSources>
  <packageSourceCredentials>
    <xxx>
      <add key="Username" value="xxxx" />
      <add key="Password" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxx==" />
    </xxx>
  </packageSourceCredentials>
</configuration>

If I add a nuget restore task it works fine by pulling from the internal feed.如果我添加一个 nuget 恢复任务,它可以通过从内部提要中正常工作。 Where I get stumped is the "The data is invalid" error, I can't find a reference to it anywhere.我被难住的地方是“数据无效”错误,我在任何地方都找不到对它的引用。

Thanks for your help.谢谢你的帮助。

NuGet 4.8.2 and later supports the Azure Artifacts Credential Provider, which automatically acquires feed credentials when needed. NuGet 4.8.2 及更高版本支持 Azure 工件凭据提供程序,它会在需要时自动获取提要凭据。 We need to use the v3 endpoint of the nuget feed.我们需要使用 nuget 提要的 v3 端点。 For example: xxx.xx.x.xx:8080/tfs/xxx/_packaging/xxx/nuget/v3/index.json .例如: xxx.xx.x.xx:8080/tfs/xxx/_packaging/xxx/nuget/v3/index.json Please refer to this document .请参阅本文档

We can use Azure Artifacts Credential Provider to authenticate and restore the feeds.我们可以使用Azure Artifacts Credential Provider来验证和恢复提要。 The Azure Artifacts Credential Provider automates the acquisition of credentials needed to restore NuGet packages as part of your .NET development workflow.作为 .NET 开发工作流程的一部分,Azure Artifacts Credential Provider 可自动获取恢复 NuGet 包所需的凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM