Visual Studio not downloading DLL for NuGet package
For the benefit of searchers (as this caused me some frustration).
I had a similar problem when I moved to a new machine (Windows 10), Nuget (fine on my old Win10 machine) would bring down everything but the dlls.
Solution
- Go to the start menu and type 'Allow an app through windows firewall'
- Click 'Change settings', then 'Allow another app'
- Enter your Visual studio location(s) (e.g. for VS 2017 - C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE, then click devenv.exe)
- Just to be sure, I checked both private and public networks.
- Deleted the packages folder
- Package restore, or rebuild the project
This fixed it for me. Hopefully it will help someone else too.
Posting this as an answer so others can find it, even though you seem to have found the answer yourself. I've been through this problem, so understand your issue.
First close all instances of Visual Studio. This is generally a good idea when doing anything outside of VS that will affect what VS thinks is going on.
As you saw, you need to use the command line version of nuget to clear your cache. Your first problem is finding this, as it's not obvious. Your second problem (if you search for it) is that you'll find loads of them, one in the .nuget folder in each solution.
The easiest way to get around this is to download the latest nuget.exe from their web site. Save it somewhere away from any projects in case you need it again.
At this point, you won't be able to run the command to clear the cache, as you'll need to upgrade nuget itself first. I agree that this seems odd, given that you've just downloaded the latest, but you'll need to do the following...
nuget update -self
Once you've done that, you can then clear your cache as jessehouwing mentioned...
nuget.exe locals all -clear
When you next start Visual Studio, you should find that all works as expected. You may need to uninstall and reinstall the packages to get it all working, but with the cache cleared, that should work without problem.
Hope that's all clear.
This is the sort of thing that really frustrates us programmers. Not coding, just messing around with something that runs on one PC, but not another.
It happens far too often frankly.
Anyway I thought I'd share a little slider panel that had a checkbox in it that solved this problem for me.
I was getting the little yellow asterisks icon on my references for some packages.
Issuing Update-Package -Reinstall
was failing because these packages had dependencies on others.
Going into the nuget menu I seen an "Options" slider. Click it.
So now you see something like this:
Now checking that permitted the forced reinstall of the offending package.
BTW I've spent couple of hours already on this (and it's not the first time with this same problem), when starting development on a new machine.