"Конец записи центрального каталога не найден" - NuGet в сообществе VS 2015

Я получаю сообщение об ошибке при попытке установить любой пакет из NuGet в версии сообщества VS 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 ==========

Сообщение об ошибке, которое я получаю, находится на вкладке "Список ошибок"

End of Central Directory record could not be found

Я попробовал приложение Console в библиотеках классов и получил эту ошибку для всех пакетов, которые я пытался установить.

Версия NuGet: 3.0.60624.657

Любая помощь будет оценена

Ответ 1

Зайдите в папку решений и удалите папку "packages". Вам нужно щелкнуть правой кнопкой мыши свое решение и выбрать "Управление пакетами" и нажать кнопку "Восстановить" в верхней части экрана, где указано, что пакеты отсутствуют.

Ответ 2

Удалите папку "пакеты" в папке вашего проекта. Протрите данные из этих папок:

%USERPROFILE%\.nuget\packages

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

%USERPROFILE%\AppData\Local\dnu\cache

Затем откройте решение и щелкните правой кнопкой мыши дерево решений и выберите "Восстановить пакеты NuGet".

Ответ 3

Я получил эту ошибку сейчас от другой глупой причины: у меня закончилось дисковое пространство! Если эти решения не работают для вас, это еще одна вещь, чтобы проверить.

Ответ 4

Попробуй дальше:

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.

Ответ 5

Я знаю, что это старая проблема. Недавно я столкнулся с подобной проблемой. Открыл окно cmd от имени администратора. С компакт-диска в папку nuget exe Я запустил обновление nuget -self Вышеуказанные действия решили мою проблему