We have a few NuGet packages on our local TeamCity server, and use these in various projects. I have just come back from holiday, grabbed the latest from source code, and tried to rebuild, only to get a pile of compilation errors due to a missing DLL.
It seems that the DLL for one of our packages was not downloaded from NuGet. I tried starting a new WPF project, and adding three of the packages. All three appear in the packages.config file, but only two of them have the DLLs downloaded. The third has only the *.pdb file downloaded.
No-one else on the team has this problem, and I tried it on my spare machine, and it downloaded fine, so it looks like it's an issue with my machine, Visual Studio or NuGet installation. However, as I can grab other packages from the same source without problem, it doesn't look like it's a global problem with either VS or NuGet.
I realise there isn't much to go on, but I don't know what else to tell you. If anyone can suggest anything, I would be very grateful. As the package source is our own, I can't share that unfortunately.
I'm using Visual Studio Enterprise 2015 Update 3 (build 14.0.25424.00) with NuGet package manager version 3.4.4.1321 on Windows 10 Pro 64 bit (version 1607, build 14393.105). If there's anything else I can add, please let me know.
Either make an account on the Nuget.org website, then log in, browse to the package you want and click on the Download link on the left menu. Then simply unzip the . nupkg file and extract the contents you need.
Restore packages manually using Visual StudioEnable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.
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.
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
This fixed it for me. Hopefully it will help someone else too.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With