AZ-500 · Question #636
Drag and Drop Question You use an Azure pipeline to build a .NET app that has NuGet dependencies. You need to ensure that the pipeline caches required NuGet packages. How should you configure the…
The correct answer is $(Agent.Id); $(Build.SourcesDirectory)/**/packages.lock.json; nuget; nuget; $(Nuget_PACKAGES). The correct pipeline configuration uses $(Agent.Id) as the cache key prefix to scope the cache to a specific agent, combined with $(Build.SourcesDirectory)/**/packages.lock.json as the lock file path to invalidate the cache when dependencies change. The 'nuget' value is used…
Question
Exhibit
Answer Area
Drag items
Correct arrangement
- $(Agent.Id)
- $(Build.SourcesDirectory)/**/packages.lock.json
- nuget
- nuget
- $(Nuget_PACKAGES)
Explanation
The correct pipeline configuration uses $(Agent.Id) as the cache key prefix to scope the cache to a specific agent, combined with $(Build.SourcesDirectory)/**/packages.lock.json as the lock file path to invalidate the cache when dependencies change. The 'nuget' value is used for both the cache task identifier/alias and the path hint, while $(NuGet_PACKAGES) specifies the actual directory where NuGet packages are stored on the agent - this is the standard environment variable pointing to the global NuGet packages folder that the Cache task should restore to and save from.
Topics
Community Discussion
No community discussion yet for this question.
