构建ASP.NET解决方案Azure DevOps时无法读取私有NuGet路径

时间:2019-04-03 07:15:03

标签: azure-devops azure-pipelines

在Microsoft Azure DevOps中配置NuGet还原时,我无法读取私有的NuGet路径。

错误是:

  

未找到nugetConfigPath:   D:\ a \ 1 \ s \ https:\ XXXX.pkgs.visualstudio.com_packaging \ XXX \ nuget \ v3 \ index.json

1 个答案:

答案 0 :(得分:1)

  

在构建asp.net解决方案Azure DevOps时无法读取私有NuGet路径

在Azure Devops中使用nuget恢复任务时,有两个选项可以选择要使用的nuget提要:

enter image description here

选择第一选项时,您可以直接选择私有的NuGet提要,例如:

enter image description here

选择 second 选项时,应在存储库中指定nuget.config,该存储库指定要从中还原软件包的feed,例如:

enter image description here

nuget.config中的feed中的配置如下:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="AzureDevOpsFeed" value="https://pkgs.dev.azure.com/MyCustomOrganization/_packaging/MyCustomFeed/nuget/v3/index.json" />
  </packageSources>


  <packageSourceCredentials>
    <AzureDevOpsFeed>
      <add key="Username" value="xxx" />
      <add key="ClearTextPassword" value="xxx" />
    </AzureDevOpsFeed>
  </packageSourceCredentials>
</configuration>

错误的原因是您将私有nuget提要路径添加到第二个选项,这是不正确的。您应该从第一个选项中选择您的私人nuget提要。

希望这会有所帮助。