我如何使用“此提要”中的工件我的管道中的来源?

发布于 2025-01-14 01:57:24 字数 1580 浏览 1 评论 0原文

我已成功将 NuGet 包推送到 Azure DevOps Artifacts 中的源:

在此处输入图像描述

但是,我想在我的管道中使用此包,因为当前失败,因为它找不到该包。我尝试使用创建工件提要时获得的 URL 在项目设置中添加服务连接:

< img src="https://i.sstatic.net/1P0nX.png" alt="在此处输入图像描述">

但是,我的构建仍然失败,因为它找不到包。

这是我的管道 YAML 文件:

trigger:
  batch: true
  branches:
    include:
    - master
    - develop
    - release/*

pr:
  autoCancel: false
  branches:
    include:
    - master
    - develop
    
pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetAuthenticate@0
  inputs:
    nuGetServiceConnections: 'Azure DevOPS Nuget feed (see Artifacts)'
- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'
    feedsToUse: config
    nugetConfigPath: nuget.config
    externalFeedCredentials: 'Azure DevOPS Nuget feed (see Artifacts)'

- task: GitVersion@5
  inputs:
    runtime: 'full'
    updateAssemblyInfo: true

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

更新:它现在似乎转到了正确的 NuGet 源,但无法在步骤 NuGetCommand 中进行身份验证。

如何使用刚刚推送到 Azure DevOps 中的 Artifact feed 的 NuGet 包?

I have successfully pushed my NuGet package to a feed in my Azure DevOps Artifacts:

enter image description here

But, I want to use this package in my pipeline, because this currently fails because it cannot find the package. I tried to add a service connection in my Project Settings, using the URL I get when creating the artifact feed:

enter image description here

But still, my build fails because it cannot find the package.

This is my pipeline YAML file:

trigger:
  batch: true
  branches:
    include:
    - master
    - develop
    - release/*

pr:
  autoCancel: false
  branches:
    include:
    - master
    - develop
    
pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetAuthenticate@0
  inputs:
    nuGetServiceConnections: 'Azure DevOPS Nuget feed (see Artifacts)'
- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'
    feedsToUse: config
    nugetConfigPath: nuget.config
    externalFeedCredentials: 'Azure DevOPS Nuget feed (see Artifacts)'

- task: GitVersion@5
  inputs:
    runtime: 'full'
    updateAssemblyInfo: true

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Update: it seems to go to the correct NuGet feed now, but it fails to authenticate in step NuGetCommand.

How can I use the NuGet package I just pushed to the Artifact feed in Azure DevOps?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

另类 2025-01-21 01:57:24

我使用 DevOps YAML 编辑器将正确的步骤添加到我的 azure-pipelines.yml 中。我添加了一个 NuGet 步骤:

在此处输入图像描述

使用此 Azure Artifacts/TFS feed 中的包选项中,我可以选择我的 Artifacts feed。这将此任务添加到 YAML 文件中:

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: '<<UUID>>'

并且成功了!

I used the DevOps YAML editor to add the correct steps to my azure-pipelines.yml. I added a NuGet step:

enter image description here

In the Use packages from this Azure Artifacts/TFS feed option, I could select my Artifacts feed. This added this task to the YAML file:

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: '<<UUID>>'

And it worked!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文