簡體   English   中英

“找不到中央目錄記錄的結尾”- VS 社區 2015 中的 NuGet

[英]"End of Central Directory record could not be found" - NuGet in VS community 2015

當我嘗試從 VS 社區版 2015 中的 NuGet 安裝任何包時出現錯誤。

Attempting to gather dependencies information for package 'Microsoft.Net.Http.2.2.29' with respect to project 'ClassLibrary1', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'Microsoft.Net.Http.2.2.29' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Microsoft.Net.Http.2.2.29'
Resolved actions to install package 'Microsoft.Net.Http.2.2.29'
Install failed. Rolling back...
Package 'Microsoft.Bcl.Build 1.0.14' does not exist in project 'ClassLibrary1'
Package 'Microsoft.Bcl.Build 1.0.14' does not exist in folder 'C:\Users\441793\documents\visual studio 2015\Projects\ClassLibrary1\packages'
System.IO.InvalidDataException: End of Central Directory record could not be found.
   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
   at System.IO.Compression.ZipArchive.Init(Stream stream, ZipArchiveMode mode, Boolean leaveOpen)
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode)
   at NuGet.Packaging.NuGetPackageUtils.ExtractPackage(String targetPath, FileStream stream)
   at NuGet.Packaging.NuGetPackageUtils.<>c__DisplayClass1_0.<<InstallFromStreamAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLocked>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLocked>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at NuGet.Packaging.NuGetPackageUtils.<InstallFromStreamAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at NuGet.Protocol.Core.v3.GlobalPackagesFolderUtility.<AddPackageAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at NuGet.Protocol.Core.v3.DownloadResourceV3.<GetDownloadResourceResultAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.PackageDownloader.<GetDownloadResourceResultAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteNuGetProjectActionsAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteNuGetProjectActionsAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.UI.UIActionEngine.<ExecuteActionsAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.UI.UIActionEngine.<PerformActionAsync>d__3.MoveNext()
========== Finished ==========

我收到的錯誤消息在錯誤列表選項卡中是

End of Central Directory record could not be found

我嘗試從控制台應用程序到類庫,並為我嘗試安裝的所有軟件包收到此錯誤。

NuGet 版本是:3.0.60624.657

任何幫助將不勝感激

進入解決方案文件夾並刪除“packages”文件夾。 您需要右鍵單擊您的解決方案並選擇“管理包”,然后單擊屏幕頂部的“恢復”按鈕,它會告訴您包裹丟失。

刪除項目文件夾中的文件夾“packages”。 擦除這些文件夾中的數據:

%USERPROFILE%\\.nuget\\packages

%USERPROFILE%\\AppData\\Local\\NuGet\\v3-cache

%USERPROFILE%\\AppData\\Local\\dnu\\cache

然后打開解決方案並右鍵單擊解決方案樹,然后單擊“Restore NuGet Packages”。

我剛才從另一個愚蠢的原因得到了這個錯誤:我的磁盤空間不足! 如果這些解決方案不適合您,則需要檢查另一件事。

試試下一個:

D:\src\build>nuget locals -clear all
Clearing NuGet HTTP cache: C:\Users\dzmitry\AppData\Local\NuGet\v3-cache
Clearing NuGet cache: C:\Users\dzmitry\AppData\Local\NuGet\Cache
Clearing NuGet global packages cache: C:\Users\dzmitry\.nuget\packages\
WARNING: Local resources partially cleared.
WARNING: Failed to delete 'C:\Users\dzmitry\.nuget\packages\'.
WARNING: Failed to delete 'C:\Users\dzmitry\.nuget\packages\fsharp.data.xmlprovider\2.3.14159\lib\net40\FSharp.Data.DesignTime.dll'.
Clearing local resources failed: one or more errors occured.

我知道這是一個老問題。 我最近遇到了類似的問題。 以管理員身份打開cmd窗口。 CD到nuget exe文件夾我跑了nuget update -self上面的步驟解決了我的問題

嘗試打開我自己的 NuGet 包時出現此錯誤。 我的 NuGet 包基於 .7z 文件而不是 .zip 文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM