NuGet does not unpack assemblies from a package

Environment: VS Enterprise 2015 Update 1, Manager Package Host Console Manager 3.3.0.167

Steps to play: just create a new project (for example, a console application) designed to install .Net 4.5.2 (but also with other versions of .net).

When I install the nuget package, the package is downloaded and it would seem to install without errors. However, nuget does not add a link to the dll. When viewing the packages folder, it turns out that the unpacked .dlls were not unpacked, although the .nupkg file exists and is not corrupted (I can open it with the nuget explorer package and see the contents of the lib folder).

Any idea what could be causing this?

The output in the package manager console is:

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 

package folder contents:

 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 with some, but not all nuget packages

+5
source share
3 answers

The workaround described on this page seems to have worked - 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.2011 at 12:16

Just fixed it on my system>. I went to the NuGet user cache (C: \ Users \ .nuget \ packages) and deleted everything in there. I think that during the recovery process, my cache was cleared of all DLLs, and when I tried to install the package, it used the cache, not the NuGet files. Now that I have cleared the cache, now I can install the NuGet packages.

+12
source

I just ran into this problem (VS2017 Enterprise), and while the above answer did not solve the problem, deleting everything in the package folder for the solution.

+1
source

Similar behavior on our build agent. Reason: the .nupkg file has been added to the repository! In this case, nuget assumes that the package already exists and will not decompress the .nupkg file.

Deleted the file from the repository, and the assembly passed.

0
source

Source: https://habr.com/ru/post/1239557/


All Articles