Lie*_*ero 4 .net nuget azure-devops azure-pipelines .net-5
我正在使用以下步骤来执行解决方案级别缓存:
- 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'
Run Code Online (Sandbox Code Playgroud)
但是,其中Post-job: Cache NuGet packages有警告:
##[警告]给定的缓存键在恢复和保存步骤之间的解析值已更改
我意识到这是因为在解析密钥时还选择了复制到输出目录 */bin/release/net5.0/packages.lock.json 文件的锁定文件。
我该如何解决这个问题?
通过在键中使用以下模式修复:
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json,!**/bin/**,!**/obj/**'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3333 次 |
| 最近记录: |