How does the caching work for solution restores? Generating a lock file is done by enabling the RestorePackagesWithLockFile option in the project file, but that generates separate lock files for each project. Do i need to cache them all separately? Or is there a way to combine the lock files?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
any info about this? We would really like to try the caching feature, but we need some clarification about solution level caching. Adding separete caching tasks for 50 project lock files doesn't really seem viable
@Paul you have to specify the key with a relative path and collect all of the lock files:
nuget | **/packages.lock.json
packages.lock.json cause a lot of issues if you're on a different platform between the dev machines and the ci agents (eg windows vs linux). It'll keep complaining that sha's are different.
project.assets.json are only generated when the restore happens, and because the path only accepts a path and not a glob pattern it can be a lot of work to go cache/restore those before the cache of the packages' binaries.
I ended up using nuget | **/*.csproj, it's not ideal but works ok for the purpose.
You still need to execute the dotnet restore after in order to generate the project.assets.json required for the build to work and can't skip the restore like you'd do with npm using a cache hit variable.
Thanks for your question. It looks like your question isn't an issue with the documentation, but an issue or question specific to your implementation or a bug in the product itself.
For help with a specific task, here are a couple of options where you might consider asking your question:
If you've encountered an issue with the product itself, to make sure it gets in front of the right people, please submit your bug here.
If you have an idea for improving the product, please submit your idea here.
Most helpful comment
@Paul you have to specify the key with a relative path and collect all of the lock files:
nuget | **/packages.lock.json