The azure devops cache task are restoring the Nuget packages to wrong path.

Copper Contributor

Hi folks.
May be somebody can help me to resolve the issue here.
I am using the azure devops cache to prevent the Nuget to download the packages each time from internet.
The cache look correct after it restored except the path of the restored package.

The project are looking for the microsoft.bcl at packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets.
and it work correctly when i use the NuGet Restore ,  restored to correct path packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets.
But when i use the azure devops cache i see the package restored to packages\\1.0.21\build\Microsoft.Bcl.Build.targets.
I am not understand why its under wrong path after restored from azure devops cache.
May be i am missing something here.

Thank you in advance.

- task: Cache@2
  displayName: 'NuGet Cache'
    key: 'nuget | "$(Agent.OS)" | **/packages.lock.json,!**/bin/**,!**/obj/**'
    restoreKeys: |
       nuget | "$(Agent.OS)"
    path: '$(System.DefaultWorkingDirectory)\\project_name/packages'
    cacheHitVar: 'CACHE_RESTORED'
0 Replies