gpt4 book ai didi

azure-devops - Azure DevOps 服务器上 NuGet 推送的“允许跳过重复项”警告和 409 错误

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

在 Windows Server 2019 代理上运行的 Azure DevOps Server(版本 2019.0.1)中,如果为 NuGet 推送任务选择了“允许跳过重复项”选项,则会显示警告:

The 'Allow duplicates to be skipped' option is currently only available on Azure Pipelines. If NuGet.exe encounters a conflict, the task will fail.



任务导致以下错误,导致任务失败,表明上述警告适用:

Response status code does not indicate success: 409 (Conflict - The feed already contains 'MyPackage X.Y.Z'. (DevOps Activity ID: 1A57312F-3C56-4E4D-9E78-73C7072A288F)).



我想知道这个问题是否是 Azure DevOps Server(而不是 Azure DevOps Services)特有的,或者我做错了什么,或者是否有其他解决方法。我从 this comment 注意到其他人也有同样的问题在另一个问题上提到,在有人询问如何忽略错误 409(重复包)后,该选项可用。

我想使用 NuGet 任务忽略重复的包,理想情况下是 Azure DevOps 服务器上的“允许跳过重复项”选项。我知道它可以使用脚本来解决,但如果可能的话,我更愿意避免这种情况。任何帮助表示赞赏。

最佳答案

如果您切换到 azure 管道(这似乎是一种新的做事方式),您可以使用 dotnet 命令。--skip-duplicate 选项将在 dotnet core 3.1(仍处于预览版)中提供,用于 dotnet nuget push 命令(无需使用 NuGet 命令,因为它已在 dotnet 中可用)。
但是,如果您安装最新的 .NET Core,您现在就可以使用它。

例如,这是一个阶段,它将获取您在特定文件夹中获得的任何 nuGet,安装支持跳过重复项的最新 dotnet 核心并将其推送到存储库提要。

- stage:
displayName: 'Release'
condition: succeeded()
jobs:
- job: 'Publish'
displayName: 'Publish nuGet Package'
steps:
- download: current
artifact: $(PIPELINE_ARTIFACT_NAME)
displayName: 'Download pipeline artifact'
- script: ls $(PATH_PIPELINE_ARTIFACT_NAME)
displayName: 'Display contents of downloaded articacts path'
- task: NuGetAuthenticate@0
displayName: 'Authenticate in NuGet feed'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 3.1 (preview)'
inputs:
packageType: sdk
version: '3.1.100-preview2-014569'
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet nuget push $(PATH_PIPELINE_ARTIFACT_NAME)/**/*.nupkg --source $(NUGET_FEED) --api-key $(NUGET_API_KEY) --skip-duplicate
displayName: 'Uploads nuGet packages'

关于azure-devops - Azure DevOps 服务器上 NuGet 推送的“允许跳过重复项”警告和 409 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56834744/

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