Visual Studio - Nuget - Unable to load the service index for source

21,533

Visual Studio - Nuget - Unable to load the service index for source

This is a common error, we could not get much useful info from this error message. We could only provide the troubleshootings for this issue.

The reason for this issue in most cases is because the network issue or the incorrect configuration in the nuget.config.

In order to make sure that whether this issue is related to the VS IDE, the network or others, first, please open the path of the nuget server https://api.nuget.org/v3/index.json in the browser. If you can open it in the browser, this issue probably more related to the VS IDE/nuget.config. You can delete nuget.config in the %appdata%\Nuget, then restart the Visual Studio to generate the new nuget.config.

Second, if you also could not open it in the browser, this issue probably related to the network issue, you should check if you have proxy variable http_proxy in our system variables or in the IE browser, we could test it on another PC with same network. if you have the proxy settings in your PC, you can remove it to test it or you can add proxy settings into Nuget.Config file. Refer to this link for details: Nuget Config Section & Nuget Proxy Settings. After we confirm we do not have any proxy in our PC, then we should to check if our network is limited. We could test it with a different net work.

See the same issue for some more details.

Share:
21,533
user2274060
Author by

user2274060

Updated on April 18, 2021

Comments

  • user2274060
    user2274060 about 3 years

    This is my NuGet.config :

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

    Now, in Visual Studio, when I try to install 'geckofx45' package, I get the following error :

    install-package geckofx45 install-package : Unable to load the service index for source https://api.nuget.org/v3/index.json. At line:1 char:1 + install-package geckofx45 + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

    Do you have any solutions ?

    Thank you in advance

  • C.M.
    C.M. over 4 years
    Deleting my nuget.config, re-opening VS, then re-adding my custom package source worked for me.
  • Paul Richard
    Paul Richard over 4 years
    I could open https://api.nuget.org/v3/index.json on my browser. So, I deleted the nuget.config and retried. But no success for me, I'm still having the issue.
  • Marcello
    Marcello over 3 years
    I confirm, using VS Community 2019, solution is cancel nuget.config file.