NuGet 不会从包中解压缩程序集 [英] NuGet does not unpack assemblies from package

查看:84
本文介绍了NuGet 不会从包中解压缩程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:VS Enterprise 2015 Update 1,包管理器控制台主机版本 3.3.0.167

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

重现步骤:只需创建一个针对 .Net 4.5.2 的新项目(例如控制台应用程序)(但也尝试使用其他 .net 版本).

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).

当我安装 nuget 包时,该包被下载并安装似乎没有错误.但是,nuget 不会添加对 dll 的引用.在包文件夹中查看时,虽然 .nupkg 文件在那里并且没有损坏(我可以使用 nuget 包资源管理器打开它并查看 lib 文件夹的内容),但结果发现没有解压的 .dll.

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

包文件夹的内容:

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

更新:发生在一些,但不是所有的 nuget 包

UPDATE: Happens to some, but not all nuget packages

推荐答案

此页面上概述的解决方法似乎有效 - 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

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

Miles Rush 于 2015 年 11 月 25 日下午 12:16 发布

Posted by Miles Rush on 11/25/2015 at 12:16 PM

刚刚在我的 > 系统上修复了这个问题.进入用户配置文件 NuGet 缓存(C:\Users\.nuget\packages),并删除所有内容那里.我认为在恢复过程中我的缓存被清除了DLL 文件,当我尝试安装软件包时,它使用的是缓存而不是 NuGet 的文件.现在我已经清除了缓存,我现在可以安装 NuGet 包了.

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.

这篇关于NuGet 不会从包中解压缩程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆