'Nuget add packages gives access denied errors

When I add Nuget packages via the Visual Studio 2015 GUI some packages don't install with the following error

Access to the path 'Microsoft.DotNet.InternalAbstractions.dll' is denied.

I tried running Visual Studio 2015 as Administrator and uninstalling the packages and adding them again but I still get the same error



Solution 1:[1]

Go to the dll path and make sure to give the right permission access to the local machine :

I usually do the below :

1- Untick the Read-only field :

enter image description here

2- Add the missing user access :

enter image description here

Solution 2:[2]

I close my Visual Studio.. and start it again as an administrator... It Worked.

Solution 3:[3]

This happened to me because I have cleared the NuGet cache.

I did the oldest trick in the book. I restarted my PC and then I was able to restore packages

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samidjo
Solution 2 Barkha Upadhyay
Solution 3 nak