Search code examples
nugetvisual-studio-2017dotnet-cli

dotnet new --install is looking at wrong NuGet server


Running:

dotnet new --install Microsoft.AspNetCore.SpaTemplates::*

Generates the below error:

C:\Program Files (x86)\dotnet\sdk\1.0.4\Nuget.targets(97,5): error : Unable to laod the service index for source https://MYNugetFeed.pkgs.visualstudio.com/_packaging/Project/nuget/v3/index.json. \r [C:\Users\me\.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj]

C:\Program Files (x86)\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Response status code does not indicate success: 401 (Unauthorized).

So my questions is why is it looking at that NuGet feed and not the standard (assuming that's where these templates are) and how do I change the configuration for dotnet cli? I know this is environment related in some way.


Solution

  • It sounds like your computer has a global nuget configuration that points to that feed. You can change that behaviour for a specific directory and it's children by creating a new nuget.config file.

    You can find out how the local files override global ones on the Configuring Nuget Behavior page of the Nuget documentation.