简体   繁体   English

Telerik Nuget package 在 Azure 中恢复构建管道失败

[英]Telerik Nuget package restore in Azure build pipeline fails

I'm attempting to pull Nuget packages from Telerik's Nuget repository into an Azure build pipeline, however, none of the pipeline configuration attempts I've made seem to work.我正在尝试将 Nuget 包从 Telerik 的 Nuget 存储库拉入 Azure 构建管道,但是,我所做的所有管道配置尝试似乎都不起作用。 I either receive an error stating my nuget.config is not formatted correctly or a 401 error when connecting to the repository.我要么收到一条错误,指出我的 nuget.config 格式不正确,要么在连接到存储库时收到 401 错误。

The below configuration section is from my build definition.下面的配置部分来自我的构建定义。 I've tried using NuGetCommand as well as NuGetRestore:我试过使用 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'

Here is my 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>

Here is the error I receive:这是我收到的错误:

NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://nuget.telerik.com/v3/index.json . NuGet.Protocol.Core.Types.FatalProtocolException:无法加载源https://nuget.telerik.com/v3/index.json的服务索引。 ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized). ---> System.Net.Http.HttpRequestException:响应状态代码不表示成功:401(未授权)。

Tweaking the configuration slightly I get this error:稍微调整配置我得到这个错误:

##[error]The nuget command failed with exit code(1) and error(NuGet.Configuration.NuGetConfigurationException: NuGet.Config is not valid XML. Path: 'D:\a\1\Nuget\tempNuGet_966.config'. ---> System.Xml.XmlException: An error occurred while parsing EntityName. Line 10, position 46. ##[错误]nuget 命令失败,退出代码 (1) 和错误(NuGet.Configuration.NuGetConfigurationException:NuGet.Config 无效 XML。路径:'D:\a\1\Nuget\tempNuGet_966.config'。- --> System.Xml.XmlException: An error occurred while parsing EntityName. Line 10, position 46.

I based my build tasks on the NuGetCommandv2 and NuGetRestore v1 documentation as well as what I found on Telerik's site.我的构建任务基于 NuGetCommandv2 和 NuGetRestore v1 文档以及我在 Telerik 网站上找到的内容。

When we want to use private nuget packages like Telerik we need to specify credentials in Nuget.config_当我们想使用像Telerik这样的私有 nuget 包时,我们需要在Nuget.config_中指定凭证

  • Connection name连接名称
  • Feed URL饲料 URL
  • Username用户名
  • Password密码

NOTE:笔记:
In order to add a reference to this NuGet package to your project, firstly need to add Telerik credentials into Visual Studio .为了将对此 NuGet package 的引用添加到您的项目中,首先需要将Telerik凭据添加到Visual Studio中。

example:例子:

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

Here I found one reference github by Lance McCarthy在这里,我找到了 Lance McCarthy 的参考文献github

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

相关问题 如果管道失败,如何停止触发器 Azure Datafactory - How to stop trigger if pipeline fails Azure Datafactory Azure 管道不应用 label 到 Docker 构建容器 - Azure pipeline not applying label to Docker build container .NET Azure sdk 资源管理器 - NuGet package:稳定版 - .NET Azure sdk resource manager - NuGet package: Stable release 全局禁止 NuGet 恢复作为 Azure DevOps 中其他 do.net 命令的副作用 - Globally disallow NuGet restore as side effect of other dotnet commands in Azure DevOps Azure 管道无法构建文件范围的项目 - Azure Pipeline cannot build File scoped project pip 在 azure 管道中安装 azure-functions 失败,执行 pip 身份验证任务 - pip install azure-functions in azure pipeline fails with pip authenticate task 在 Azure 管道中安装 AWS lambda 工具时选择 nuget.org 作为源 - Selecting nuget.org as the source when installing AWS lambda tools in an Azure pipeline 如何根据提交消息触发 azure devops build pipeline? - How to trigger azure devops build pipeline based on the commit message? Azure 管道在构建过程中替换 json 键值 - Azure pipeline replace json key value during build process 在推送到子模块时触发 Azure 管道构建? - Trigger an Azure Pipeline Build on push to a sub-module?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM