dotnet new --install Microsoft.AspNetCore.SpaTemplates::* fails when multiple packageSources are specified in NuGet.Config
See original GitHub issueSteps 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:
- Created 6 years ago
- Reactions:3
- Comments:8 (3 by maintainers)
Top GitHub Comments
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.This affected me too. The workaround unblocks me, but at the very least the guidance in the error message could be improved.