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

5

10

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?

Nazarite answered 11/4, 2018 at 11:7 Comment(0)
B
21

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.

Blamed answered 12/4, 2018 at 3:4 Comment(3)
Deleting my nuget.config, re-opening VS, then re-adding my custom package source worked for me.Bishop
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.Ossify
Yes, it is a common error... which is why it's ridiculous that Microsoft doesn't get busy and fix the problem. I have VS2017 and VS2019 both installed on my machine and it has always been a problem switching between them. Now, both are broken and none of the hacks suggested on the web are un-breaking either one. It was working, then it broke, nothing changed with config files. My account on another computer works fine. Where are the logs to debug or the messed up credential files hidden????Cheri
P
5

dotnet restore --interactive solved issue for me.

Peper answered 13/6, 2022 at 19:27 Comment(0)
D
0

Tested on Windows 7

Step1: Open Command window (run cmd) Step 2: Run the following commands to enable TLS 1.2 support if it is disabled (adding REGISTRY Entries):

"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:32 reg add 
"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:64 reg add 
"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:32 reg add 
"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:64
Deflower answered 17/4, 2021 at 10:18 Comment(0)
S
0

For me the issue was solved moving to another VS version. It did not work on VS 2022 but it did in VS 2019

Sociality answered 5/10, 2022 at 19:2 Comment(0)
S
-2
nuget restore 

and

msbuild /t:restore

both didn't work for me. But

dotnet restore 

worked perfect. Try that

Silverstein answered 2/10, 2020 at 5:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.