Home > Enterprise >  Nuget not installing packages
Nuget not installing packages

Time:09-28

Goal

My goal is to simply install a package via NuGet Package Manager.

I decided to delete Visual Studio 2019 and re-install it. Hoping it'll solve my issue. Then, I created a new project - tried downloading a Newtonsoft.Json package and same errors are displayed.

Error

Severity    Code    Description Project File    Line    Suppression State
Error       The feed 'nuget.org [https://api.nuget.org/v3/index.json]' lists package 'Newtonsoft.Json.13.0.1' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.
Unable to find package 'Newtonsoft.Json.13.0.1'.                

What I tried

I tried the following solution: https://stackoverflow.com/a/52327750/12485722

It displays the same error again.

Also, have tried to install another package such as Microsoft.Extensions.DependencyInjection

I then took a look into the Output and this is displayed:

  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json 199ms
  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg 1ms
  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg 96ms
  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg 96ms
  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json 498ms
  CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
  CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
The feed 'nuget.org [https://api.nuget.org/v3/index.json]' lists package 'Newtonsoft.Json.13.0.1' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.
  Unable to find package 'Newtonsoft.Json.13.0.1'.
Time Elapsed: 00:00:00.9643895

I also followed steps from the Microsoft website (Quick solution for Visual Studio users) : https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore-troubleshooting

Nothing changed.

Why is my NuGet Packages not installing?

NuGet.Config

This is how my NuGet.Config looks like. Found in C:\Users\SomeUser\AppData\Roaming\NuGet.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

CodePudding user response:

These are the steps I did to make it work.

Tools > NuGet Package Manager > Package Manager Settings

Go into Package Sources

Copy the details of nuget.org

Delete nuget.org

Then, re-add nuget.org using the details you copied.

  • Related