nuget returning packages with nuget-feed's index.json in body instead of content

363 Views Asked by At

I'm using paket restore to download a large number of nuget packages from the https://api.nuget.org/v3/index.json feed.

After downloading some packages successfully, it reports a InvalidDataException: End of Central Directory record could not be found. on a package (different each time).

When I look inside the package in the Nuget cache (Windows 10), it contains the json from the index of the feed at https://api.nuget.org/v3/index.json, rather than expected content.

For example, for System.Net.Http 4.3.4.nupkg opening the file in Notepad shows the contents as:

{
  "version": "3.0.0",
  "resources": [
    {
      "@id": "https://azuresearch-usnc.nuget.org/query",
      "@type": "SearchQueryService",
      "comment": "Query endpoint of NuGet Search service (primary)"
    },
    {
      "@id": "https://azuresearch-ussc.nuget.org/query",
      "@type": "SearchQueryService",
      "comment": "Query endpoint of NuGet Search service (secondary)"
    },
// etc

So it looks like the request is somehow being redirected to the root of the feed.

Any ideas on what could be causing this, please?

1

There are 1 best solutions below

0
On

I think I have a fix, but not a reason why!

I had been clearing my Nuget cache after each error with

  • nuget locals all -clear

That didn't help. I then tried

  • paket clear-cache

And then my paket restore worked fine.