Which port is used by NuGet while downloading package through Visual Studio

19,601

Solution 1

https://nuget.org/api/v2/ means port 443 (the standard port for HTTPS)

If you're on a corporate network, port 80 and 443 are usually bounced through a proxy server.

Most likely, NuGet is not using your proxy settings for some reason, so it cannot find the proxy server and are stopped by the corporate firewall.

Solution 2

Go to file Program Files\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe.config

Set ipv6 enabled from true to false

        <system.net>
            <settings>
                <ipv6 enabled="false"/>
            </settings>
        </system.net>

Solution 3

In my case, adding the package source references (URLs that you are using to get the packages) manually in the Nuget.Config file (\users*\appdata\Roaming\Nuget\Nuget.Config) resolved the issue.

Make sure that all the nuget packages that you are referring in the solution were added to the above Nuget.Config file.

For some reason, the references got removed from my config file and i started getting this exception. Adding them manually to the config file resolved the issue in my case.

Solution 4

I was unable to download the nugget package through the console, it was giving error like:

"Unable to connect remote server"

I followed the above steps and Set ipv6 enabled from true to false. It resolved my problem.

C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.config

<system.net>
     <settings>
         <ipv6 enabled="false"/>
     </settings>
</system.net>
Share:
19,601

Related videos on Youtube

vijay
Author by

vijay

SOreadytohelp

Updated on June 04, 2022

Comments

  • vijay
    vijay almost 2 years

    I am using VS 2010 (Package Manager Console) to download NuGet (2.5.40416.9020/Latest) packages. It uses URL https://nuget.org/api/v2/. It gives me error as below.

    Install-Package : An error occurred while loading packages from'https://nuget.org/api/v2/': The remote name could not be resolved: 'nuget.org'
    At line:1 char:16
    + Install-Package <<<<  Rx-Main
        + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
        + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
    

    But when i access the same URL via browser then i am able to browse the site. I am on corporate network so firewall might block the port (Other than 80 and 443).

    So which port is used by NuGet while downloading packages via Package Manager Console (VS 2010)?

  • Nikolay Klimchuk
    Nikolay Klimchuk almost 4 years
    What if I can't find devenv.exe.config file?