web-dev-qa-db-ja.com

「中央ディレクトリの終わりレコードが見つかりませんでした」-VS Community 2015のNuGet

VS Community Edition 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

どんな助けでも大歓迎です

18
Vishnu Prasad V

ソリューションフォルダーに移動し、「パッケージ」フォルダーを削除します。ソリューションを右クリックして[パッケージの管理]を選択し、画面の上部にある[パッケージが不足していることを通知する]ボタンをクリックする必要があります。

14
Peter Morris

プロジェクトフォルダー内のフォルダー 'packages'を削除します。これらのフォルダーからデータを消去します。

%USERPROFILE%\.nuget\packages

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

%USERPROFILE%\AppData\Local\dnu\cache

次に、ソリューションを開き、ソリューションツリーを右クリックして、[NuGetパッケージの復元]をクリックします。

7
Yuri B

私は今、別の愚かな原因からこのエラーを受け取りました:私はディスクスペースが不足するでしょう!これらのソリューションがうまく機能しない場合は、確認する必要があります。

2
sectumsemper

次を試してください:

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.
2
Dzmitry Lahoda

これは古い問題です。最近、同様の問題が発生しました。管理者としてcmdウィンドウを開きました。 CDからnuget exeフォルダーへnuget update -selfを実行しました上記の手順で問題が解決しました

0
Mandi