nuget restore fails from proxy repository


  • I am trying to restore nuget packages from SonaType Nexus repository using nuget.exe.
    When i restore it from hosted repository the restore is successful.
    When i restore it from proxy repository which is pointing to a hosted repository i am getting the below error.

    System.IO.InvalidDataException: Unable to read package from path 'EnterpriseLibr
    ary.Data.6.0.1304.0.nupkg'. ---> System.IO.FileFormatException: File contains co
    rrupted data.
       at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.FindPosition(Stream arc
       at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.SeekableLoad(ZipIOBlock
    Manager blockManager)
       at MS.Internal.IO.Zip.ZipArchive..ctor(Stream archiveStream, FileMode mode, F
    ileAccess access, Boolean streaming, Boolean ownStream)
       at MS.Internal.IO.Zip.ZipArchive.OpenOnStream(Stream stream, FileMode mode, F
    ileAccess access, Boolean streaming)

    I tried

    1. upgrading nuget.exe.

    2. deleting nupkg from <SystemDrive>:\Users\<username>\AppData\Local\NuGet\Cache and executed the nugget restore

    3. update nugget package manager

    eventhough it fails with same error message.

    I could see the package downloaded in <SystemDrive>:\Users\<username>\AppData\Local\NuGet\Cache .

    I changed it to zip file and tried to extract it. I could not extract. The file size is only 1.88 kb.

    Tuesday, March 8, 2016 9:35 PM


  • Hi RaghavendraSankar,

    >>System.IO.InvalidDataException: Unable to read package from path 'EnterpriseLibrary.Data.6.0.1304.0.nupkg'. ---> System.IO.FileFormatException: File contains corrupted data.

    According to the error message, the EnterpriseLibrary broken which why it can't be restored. Please try restore other packages from this proxy repository to confirm whether the problem just occurs with this specific package or not.

    Is this SonaType Nexus repository created by yourself or others? If by yourself, I suggest you contact Sonatype for support about how to host NuGet packages correctly on SonaType Nexus repository.

    In addition, please check the packages in SonaType Nexus repository, whether it is broken on repository. And please make sure your internet connect is stabled when restore packages.

    Best Regards,

    Wednesday, March 9, 2016 8:46 AM