gpt4 book ai didi

azure - Azure 构建管道中的 Telerik Nuget 包还原失败

转载 作者:行者123 更新时间:2023-12-03 03:29:07 26 4
gpt4 key购买 nike

我正在尝试将 Nuget 包从 Telerik 的 Nuget 存储库提取到 Azure 构建管道中,但是,我所做的任何管道配置尝试似乎都不起作用。我要么收到一条错误,指出我的 nuget.config 格式不正确,要么在连接到存储库时收到 401 错误。

以下配置部分来 self 的构建定义。我尝试过使用 NuGetCommand 以及 NuGetRestore:

- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.0.2'
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: 'Telerik_v3'
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: './XXXXXXX/nuget.config'
#'$(System.DefaultWorkingDirectory)/XXXXXXX/NuGet.config'
externalFeedCredentials: 'Telerik_v3'
# - task: NuGetRestore@1
# inputs:
# solution: '**/*.sln'
# selectOrConfig: 'config'
# nugetConfigPath: './XXXXXXX/nuget.config'

这是我的 nuget.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" protocolVersion="3"/>
<add key="Telerik_NuGet" value="https://nuget.telerik.com/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>

这是我收到的错误:

NuGet.Protocol.Core.Types.FatalProtocolException:无法加载源 https://nuget.telerik.com/v3/index.json 的服务索引。 ---> System.Net.Http.HttpRequestException:响应状态代码不表示成功:401(未经授权)。

稍微调整配置我收到此错误:

##[错误]nuget 命令失败,退出代码(1) 和错误(NuGet.Configuration.NuGetConfigurationException: NuGet.Config 不是有效的 XML。路径: 'D:\a\1\Nuget\tempNuGet_966.config '. ---> System.Xml.XmlException: 解析 EntityName 时发生错误。第 10 行,位置 46。

我的构建任务基于 NuGetCommandv2 和 NuGetRestore v1 文档以及我在 Telerik 网站上找到的内容。

最佳答案

当我们想要使用像Telerik这样的私有(private)nuget包时,我们需要在Nuget.config_中指定凭据

  • 连接名称
  • 供稿网址
  • 用户名
  • 密码

注意:
为了将此 NuGet 包的引用添加到您的项目中,首先需要将 Telerik 凭据添加到 Visual Studio 中。

示例:

dotnet nuget update source "Telerik" --source "https://nuget.telerik.com/v3/index.json" --configfile "nuget.config" --username '*************' --password '***********' --store-password-in-clear-text

在这里我找到了一个引用文献github作者:兰斯·麦卡锡

关于azure - Azure 构建管道中的 Telerik Nuget 包还原失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75137324/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com