Fixing Nuget Issue – Unable to load the service index for source

It turns out when working on a .NET Core project, Nuget has problems restoring/downloading packages. On other projects using an older version of the .net framework, this doesn’t seem to happen. This happens in the office at work because we use a proxy. So to get around the problem, we need to configure Nuget to go through the proxy.

Edit the NuGet.config file located at C:\Users\\AppData\Roaming\NuGet. If you’re browsing to that folder, remember to turn on “Show hidden files, folders, and drives”.

<configuration>
    <config>
        <add key="http_proxy" value="http://www.proxy.domain:port" />
        <add key="http_proxy.user" value="thedomain\userName" />
        <add key="http_proxy.password" value="base64encodedpassword" />
    </config>
</configuration>

If your work policy enforces password reset at a regular interval, it’s better to omit the password key from the config and Nuget will still be able to use your default credentials. So you end up with this instead:

<configuration>
    <config>
        <add key="http_proxy" value="http://www.proxy.domain:port" />
        <add key="http_proxy.user" value="thedomain\userName" />
    </config>
</configuration>

Now that this is sorted, let me get back to adding more nuget packages to my project.

comments powered by Disqus