"End of central directory entry not found" - NuGet in the VS 2015 community

I get an error when trying to install any package from NuGet in the VS 2015 community version.

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 ========== 

The error message I get is on the "Error List" tab

 End of Central Directory record could not be found 

I tried the Console application in class libraries and got this error for all the packages I tried to install.

NuGet Version: 3.0.60624.657

Any help would be appreciated

+15
c # visual-studio visual-studio-2015 nuget
source share
5 answers

Go to the solutions folder and delete the "packages" folder. You need to right-click your solution and select "Package Management" and click the "Restore" button at the top of the screen, which indicates that there are no packages.

+13
source share

Delete the packages folder in your project folder. Wipe data from these folders:

%USERPROFILE%\.nuget\packages

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

%USERPROFILE%\AppData\Local\dnu\cache

Then open the solution and right-click the decision tree and select "Restore NuGet Packages".

+6
source share

I got this error now from another silly reason: I have run out of disk space! If these solutions do not work for you, this is another thing to check.

+2
source share

Try next:

 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
source share

I know this is an old problem. I recently encountered a similar problem. Opened the cmd window as administrator. From the CD to the nuget exe folder I started the nuget update -self The above steps solved my problem

0
source share

All Articles