question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet new --install Microsoft.AspNetCore.SpaTemplates::* fails when multiple packageSources are specified in NuGet.Config

See original GitHub issue

Steps to reproduce

My NuGet.config looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="SomePrivateFeedKey" value="SomePrivatePackageFeed.json" />
  </packageSources>
  <disabledPackageSources>
    <add key="Microsoft and .NET" value="true" />
  </disabledPackageSources>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

Expected behavior

dotnet new --install Microsoft.AspNetCore.SpaTemplates:😗 // Should install, not give 401 error

Actual behavior

401 error seen. dotnet new --install Microsoft.AspNetCore.SpaTemplates:😗 Restoring packages for C:\Users\brruoff.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj… C:\Program Files (x86)\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to load the service index for source https://microsoft.pkgs.visualstudio.com/_packaging/EC.Platform/nuget/v3/index.json.\r [C:\Users\brruoff.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). [C:\Users\brruoff.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj]

Environment data

dotnet --info output: C:\Users\brruoff>dotnet --info .NET Command Line Tools (1.0.4)

Product Information: Version: 1.0.4 Commit SHA-1 hash: af1e6684fd

Runtime Environment: OS Name: Windows OS Version: 10.0.15063 OS Platform: Windows RID: win10-x86 Base Path: C:\Program Files (x86)\dotnet\sdk\1.0.4

#Workaround:

Removed 2nd entry

<add key="SomePrivateFeedKey" value="SomePrivatePackageFeed.json" />

from NuGet.config temporarily --> re-ran the command --> everything installed properly. --> Re-added the 2nd entry back to the NuGet.config.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
spottedmahncommented, Oct 9, 2017

I too am facing the same problem. I don’t understand why it wouldn’t try the next source? I even re-order them in VS to put nuget.org on top and it still failed.

image

0reactions
MaxWilsoncommented, Dec 20, 2017

This affected me too. The workaround unblocks me, but at the very least the guidance in the error message could be improved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet new --install is looking at wrong NuGet server
To solve that problem, add a NuGet.Config file to the Solution folder for the project that uses Telerik packages. The new config file...
Read more >
Installing NuGet package with dependencies on multiple ...
It appears that it's impossible to specify multiple sources using the Package Manage Console (PowerShell). However, if no -Source is specified ...
Read more >
dotnet new install - .NET CLI
The dotnet new install command installs a template package from the PATH or NUGET_ID provided. If you want to install a specific version...
Read more >
NuGet Package Restore
NuGet Package Restore restores all of a project's dependencies that are listed in either a project file or a packages.config file.
Read more >
NuGet Error NU1100
Open the project file and examine the list of its dependencies. Check that each dependency exists on the package sources you're using, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found