【问题标题】:why Is [Insert Nuget Package Here] not extracting dlls为什么 [在此处插入 Nuget 包] 不提取 dll
【发布时间】:2016-04-15 21:33:38
【问题描述】:

所以我接受缓存或其他东西在我这边发生了一些奇怪的事情。显然已经清空了缓存,删除了包文件夹并重新获得了包。

https://www.nuget.org/packages/Google.ProtocolBuffers/

重命名 nupkg zip,查看并找到 dll。他们只是没有提取 - 这表示 nuspec 对于其中的文件夹结构看起来是错误的。但是很难相信只有我有这个问题。

我以前从未有过这种行为,并且已经陷入了大约 2 个小时。所以希望有人能指出非常明显的问题并解释为什么我过去使用的一个包突然变得很糟糕。

编辑以获取更多信息: 我在 vs2015 企业版中使用 4.6.1 控制台项目进行了复制(只是标准的 .net,而不是 dnx 或任何时髦的东西)。 刚用 4.5.2 试过,我也有同样的问题。没有引用被添加到项目中的任何 dll。此外,在包文件夹中没有 dll - xml 文件虽然完成了它。但是,如果我进入 nupkg,重命名为 .zip 并打开,我可以看到它们应该在的 dll。我通常也以管理员身份运行 vs - 软件包安装也从命令行失败(并不是我期望有什么不同)

额外编辑: 其他 nuget 包也在工作。我正在推进其他领域,这些领域也很重。只是这一个包给我​​带来了问题。

安装包的控制台登录

Attempting to gather dependency information for package 'Google.ProtocolBuffers.2.4.1.555' with respect to project 'ConsoleApplication1', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'Google.ProtocolBuffers.2.4.1.555' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Google.ProtocolBuffers.2.4.1.555'
Resolved actions to install package 'Google.ProtocolBuffers.2.4.1.555'
Adding package 'Google.ProtocolBuffers.2.4.1.555' to folder 'M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages'
Added package 'Google.ProtocolBuffers.2.4.1.555' to folder 'M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages'
Added package 'Google.ProtocolBuffers.2.4.1.555' to 'packages.config'
Successfully installed 'Google.ProtocolBuffers 2.4.1.555' to ConsoleApplication1
========== Finished ==========

文件夹结构(为简洁起见)

> dir /s                                                                                                                                                   
 Volume in drive M is steam                                                                                                                                
 Volume Serial Number is 747C-43B4                                                                                                                         

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages                                                                

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
16/04/2016  15:04    <DIR>          Google.ProtocolBuffers.2.4.1.555                                                                                       
               0 File(s)              0 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555                               

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
16/04/2016  15:04         2,731,847 Google.ProtocolBuffers.2.4.1.555.nupkg                                                                                 
16/04/2016  15:04    <DIR>          lib                                                                                                                    
16/04/2016  15:04    <DIR>          tools                                                                                                                  
               1 File(s)      2,731,847 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\lib                           

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
16/04/2016  15:04    <DIR>          cf20                                                                                                                   
16/04/2016  15:04    <DIR>          cf35                                                                                                                   
16/04/2016  15:04    <DIR>          net20                                                                                                                  
16/04/2016  15:04    <DIR>          net35                                                                                                                  
16/04/2016  15:04    <DIR>          net40                                                                                                                  
16/04/2016  15:04    <DIR>          portable-net40+sl4+sl5+wp7+wp8+win8                                                                                    
16/04/2016  15:04    <DIR>          sl20                                                                                                                   
16/04/2016  15:04    <DIR>          sl30                                                                                                                   
16/04/2016  15:04    <DIR>          sl40                                                                                                                   
               0 File(s)              0 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\lib\cf20                      

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
19/10/2015  20:39            71,034 Google.ProtocolBuffers.Serialization.xml                                                                               
19/10/2015  20:39           282,553 Google.ProtocolBuffers.xml                                                                                             
               2 File(s)        353,587 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\lib\cf35                      

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
19/10/2015  20:39            71,034 Google.ProtocolBuffers.Serialization.xml                                                                               
19/10/2015  20:39           282,553 Google.ProtocolBuffers.xml                                                                                             
               2 File(s)        353,587 bytes                                                                                                              
 ...
<snip>
...                                                                                                                                                            
 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\tools                         

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
19/10/2015  20:39             6,779 CHANGES.txt                                                                                                            
16/04/2016  15:04    <DIR>          google                                                                                                                 
19/10/2015  20:39             1,672 license.txt                                                                                                            
19/10/2015  20:39             1,857 protoc-license.txt                                                                                                     
16/04/2016  15:04    <DIR>          tutorial                                                                                                               
               3 File(s)         10,308 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\tools\google                  

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
16/04/2016  15:04    <DIR>          protobuf                                                                                                               
               0 File(s)              0 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\tools\google\protobuf         

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
16/04/2016  15:04    <DIR>          compiler                                                                                                               
19/10/2015  20:39             4,301 csharp_options.proto                                                                                                   
19/10/2015  20:39            21,880 descriptor.proto                                                                                                       
               2 File(s)         26,181 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\tools\google\protobuf\compiler

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
19/10/2015  20:39             7,736 plugin.proto                                                                                                           
               1 File(s)          7,736 bytes                                                                                                              

 Directory of M:\programming\general\git\akka-cluster-homebrew\ConsoleApplication1\packages\Google.ProtocolBuffers.2.4.1.555\tools\tutorial                

16/04/2016  15:04    <DIR>          .                                                                                                                      
16/04/2016  15:04    <DIR>          ..                                                                                                                     
19/10/2015  20:39               754 addressbook.proto                                                                                                      
               1 File(s)            754 bytes                                                                                                              

     Total Files Listed:                                                                                                                                   
              26 File(s)      5,960,765 bytes                                                                                                              
              50 Dir(s)  26,398,302,208 bytes free 

【问题讨论】:

  • 您能否提供更多关于您正在做什么、您正在使用什么 IDE、您将其安装到什么项目类型以及正在发生什么的更多信息? Google.ProtocolBuffers 对我来说看起来不错,并安装到带有适当参考的 .NET 4.5 项目中。 .nu​​pkg 中的 .nuspec 没有定义程序集的位置,它基于 .nupkg 中的目录名称。
  • 当然,在编辑中添加。

标签: nuget nuget-package nuget-package-restore protobuf-csharp-port


【解决方案1】:

好的,我最终找到了这个页面: 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

结果我做了两件事 1)转到%userprofile%\.nuget并删除包文件夹(但请记住,我已经这样做了,并没有单独修复它)。我注意到这里的版本反映了我遇到的问题 - 此外,由于我之前删除了这个,我知道仅仅删除这个文件夹是不够的。

2) 在管理员模式与开发命令提示符“devenv /resetuserdata

新的解决方案 4.5.2,控制台和第一次工作。

这是什么原因造成的? 不是最起雾的。

顺便说一句,安装包的控制台输出现在是:

Attempting to gather dependency information for package 'Google.ProtocolBuffers.2.4.1.555' with respect to project 'ConsoleApplication2', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'Google.ProtocolBuffers.2.4.1.555' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Google.ProtocolBuffers.2.4.1.555'
Resolved actions to install package 'Google.ProtocolBuffers.2.4.1.555'
  GET https://api.nuget.org/packages/google.protocolbuffers.2.4.1.555.nupkg
  OK https://api.nuget.org/packages/google.protocolbuffers.2.4.1.555.nupkg 14ms
Installing Google.ProtocolBuffers 2.4.1.555.
Adding package 'Google.ProtocolBuffers.2.4.1.555' to folder 'c:\users\john\documents\visual studio 2015\Projects\ConsoleApplication2\packages'
Added package 'Google.ProtocolBuffers.2.4.1.555' to folder 'c:\users\john\documents\visual studio 2015\Projects\ConsoleApplication2\packages'
Added package 'Google.ProtocolBuffers.2.4.1.555' to 'packages.config'
Successfully installed 'Google.ProtocolBuffers 2.4.1.555' to ConsoleApplication2
========== Finished ==========

【讨论】:

  • 这对我有用,虽然有一点点改变。我不得不关闭 Visual Studio 并以管理员身份启动命令提示符。 c:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE>devenv /resetuserdata
猜你喜欢
  • 2020-04-12
  • 1970-01-01
  • 2015-04-17
  • 2021-08-10
  • 1970-01-01
  • 1970-01-01
  • 2017-02-27
  • 1970-01-01
相关资源
最近更新 更多