Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am getting an error when i try to install any package from the NuGet in VS community edition 2015.

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

Error message i receive is in the Error List tab is

End of Central Directory record could not be found

I tried from Console application to Class libraries and getting this error for all packages i tried to install.

NuGet Version is : 3.0.60624.657

Any help will be appreciated

like image 444
Vishnu Prasad V Avatar asked Sep 10 '15 05:09

Vishnu Prasad V


People also ask

How do I add a NuGet package to Visual Studio 2015?

From Visual Studio, select Tools > NuGet Package Manager > Package Manager Console. After the Package Manager Console pane opens, verify that the Default project drop-down list shows the project in which you want to install the package.

How do I fix a NuGet package error?

Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.

How do I get NuGet packages in Visual Studio 2022?

In Visual Studio, select Tools, and then select Options. Select NuGet Package Manager, and then select Package Sources. Enter the feed's Name and Source URL, and then select the green (+) sign to add a new package source. If you enabled upstream sources in your feed, clear the nuget.org checkbox.

Where is .NuGet folder located?

The default is %userprofile%\. nuget\packages (Windows) or ~/. nuget/packages (Mac/Linux). A relative path can be used in project-specific nuget.


1 Answers

Go into your solution folder and delete your "packages" folder. You'll need to right-click your solution and select "Manage packages" and click the "Restore" button at the top of the screen where it tells you the packages are missing.

like image 193
Peter Morris Avatar answered Sep 20 '22 16:09

Peter Morris