gpt4 book ai didi

.net - 如何使用缓存任务缓存 Azure Pipelines 中所有项目的 nuget 包

转载 作者:行者123 更新时间:2023-12-04 13:09:50 30 4
gpt4 key购买 nike

我正在使用以下步骤来执行解决方案级缓存:

- task: Cache@2
inputs:
key: 'nuget | "$(Agent.OS)" | $(Build.SourcesDirectory)/**/packages.lock.json'
restoreKeys: |
nuget | "$(Agent.OS)"
nuget
path: $(NUGET_PACKAGES)
displayName: Cache NuGet packages

- task: DotNetCoreCLI@2
displayName: 'dotnet restore using package.lock.json'
inputs:
command: 'restore'
restoreArguments: '--locked-mode'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
然而,在 Post-job: Cache NuGet packages有警告:

##[warning]The given cache key has changed in its resolved value between restore and save steps


我已经意识到这是因为在解析 key 时还选择了复制到输出目录 */bin/release/net5.0/packages.lock.json 文件的锁定文件。
我该如何解决这个问题?

最佳答案

通过在键中使用以下模式修复:

key: 'nuget | "$(Agent.OS)" | **/packages.lock.json,!**/bin/**,!**/obj/**'

关于.net - 如何使用缓存任务缓存 Azure Pipelines 中所有项目的 nuget 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66761063/

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