Environment: VS Enterprise 2015 Update 1, Package Manager Console Host Version 3.3.0.167
Steps to reproduce: just create a new project (e.g. console application) targetting .Net 4.5.2 (but tried with other .net versions as well).
When I install a nuget package, the package is downloaded and seemingly installed without error. However, nuget does not add a reference to the dll. When looking in the packages folder, it turns out that there are no .dlls unpacked, although the .nupkg file is there and is not corrupt (I can open it with nuget package explorer and see the content of the lib folder).
Any idea what could be causing this?
Output in package manager console:
PM> install-package log4net -verbose
Attempting to gather dependencies information for package 'log4net.2.0.5' with respect to project 'ConsoleApplication4', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'log4net.2.0.5' with DependencyBehavior 'Lowest'
Resolving actions to install package 'log4net.2.0.5'
Resolved actions to install package 'log4net.2.0.5'
For adding package 'log4net.2.0.5' to project 'ConsoleApplication4' that targets 'net452'.
For adding package 'log4net.2.0.5' to project 'ConsoleApplication4' that targets 'net452'.
Adding package 'log4net.2.0.5' to folder 'c:\Projects\ConsoleApplication4\packages'
Added package 'log4net.2.0.5' to folder 'c:\Projects\ConsoleApplication4\packages'
Added package 'log4net.2.0.5' to 'packages.config'
Added file 'packages.config' to project 'ConsoleApplication4'.
Successfully installed 'log4net 2.0.5' to ConsoleApplication4
content of the package folder:
C:\Projects\ConsoleApplication4\packages\log4net.2.0.5>tree /f .
Folder PATH listing for volume OSDisk
Volume serial number is 8CE4-F2E5
C:\PROJECTS\CONSOLEAPPLICATION4\PACKAGES\LOG4NET.2.0.5
¦ log4net.2.0.5.nupkg
¦
+---lib
+---net10-full
¦ log4net.xml
¦
+---net11-full
¦ log4net.xml
¦
+---net20-full
¦ log4net.xml
¦
+---net35-client
¦ log4net.xml
¦
+---net35-full
¦ log4net.xml
¦
+---net40-client
¦ log4net.xml
¦
+---net40-full
¦ log4net.xml
¦
+---net45-full
log4net.xml
UPDATE: Happens to some, but not all nuget packages
The workaround outlined on this page seemed to work - https://connect.microsoft.com/VisualStudio/feedback/details/1656768/installing-certain-nuget-packages-fails-to-actually-extract-the-dll-files-to-the-relevant-lib-folder-and-fails-to-add-an-assembly-reference-to-the-csproj-file
Posted by Miles Rush on 11/25/2015 at 12:16 PM
Just fixed this on my > system. Went in to the user profile NuGet cache (C:\Users\.nuget\packages), and deleted everything in there. I think during the restore process my cache was cleared of all DLL files, and when I tried to install a package it was using the cache instead of the files off of NuGet. Now that I've cleared the cache, I can now install the NuGet packages.
I just encountered this issue (VS2017 Enterprise) and while the above answer did not solve the problem, deleting everything in the packages folder for the solution did.
Had a similar behavior on our build agent. Reason: the .nupkg file was added to the repository! In that case, nuget assumes that the package already exists and will not unpack the .nupkg file.
Removed the file from the repository, and the build passed.
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