dotnet restore does not try all sources for restoring
See original GitHub issueSteps to reproduce
1-Create a project that references packages from public nuget, some myget feed and a private feed that requires authentication.
2-Add Nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="myget" value="https://www.myget.org/F/***/api/v3/index.json" />
<add key="auth" value="https://nuget.***.com/nuget" />
</packageSources>
<packageSourceCredentials>
<auth>
<add key="Username" value="****" />
<add key="Password" value="****" />
</auth>
</packageSourceCredentials>
</configuration>
Note that the auth
feed uses version 2.
3-Run the following
dotnet restore --configfile NuGet.config
Expected behavior
Packages are restored.
Actual behavior
dotnet restore tries to use only the auth
feed to restore packages that reside in public nuget/myget.
Retrying 'FindPackagesByIdAsyncCore' for source 'https://[auth-feed]/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer''.
Key not valid for use in specified state
Retrying 'FindPackagesByIdAsyncCore' for source 'https://[auth-feed]/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer''.
Key not valid for use in specified state
Retrying 'FindPackagesByIdAsyncCore' for source 'https://[auth-feed]/FindPackagesById()?id='[myget-package-1]''.
Key not valid for use in specified state
Retrying 'FindPackagesByIdAsyncCore' for source 'https://[auth-feed]/FindPackagesById()?id='[myget-package-1]''.
Key not valid for use in specified state
Retrying 'FindPackagesByIdAsyncCore' for source 'https://[auth-feed]/FindPackagesById()?id='[myget-package-2]''.
Key not valid for use in specified state
Retrying 'FindPackagesByIdAsyncCore' for source 'https://[auth-feed]/FindPackagesById()?id='[myget-package-2]''.
Key not valid for use in specified state
C:\dotnet-sdk\sdk\1.0.0\NuGet.targets(97,5): error : Failed to retrieve information about '[myget-package-1]' from remote source 'https://[auth-feed]/FindPackagesById()?id='[myget-package-1]''. [D:\a\1\s\***.sln]
C:\dotnet-sdk\sdk\1.0.0\NuGet.targets(97,5): error : Key not valid for use in specified state [D:\a\1\s\***.sln]
Environment data
dotnet --info
output: 1.0.0
I should add that this error does not happen on my local machine, in fact it runs just fine. It only happens on VSTS, I use the dotnet-install.ps1 script to install 1.0.0 as following:
dotnet-install.ps1 -version "$(SdkVersion)" -installDir $(SdkPath) -Architecture x64
where:
SdkVersion=1.0.0
SdkPath=C:\dotnet-sdk
Am I doing something wrong here…?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >docker - dotnet restore looking in wrong nuget-source
The package manager was trying to get packages from private feed that supposed to be retrieved from the nuget.org. Thanks to the link...
Read more >restoring packages from nuget source fails if custom ...
I need to restore packages from the default nuget source but it fails because I also have a custom source that is only...
Read more >Dotnet restore vs nuget restore. Share. In my code repo, there
I am trying to restore NuGet packages in my project using the CLI. ... build is . nuget\packages) is considered a source not...
Read more >[REGRESSION] Package restore not working as expected
Running dotnet restore from PWSH works correctly as expected. The following log was shown in the Nuget -> Log tab: @ Restoring packages...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Has anyone seen a resolution or workaround when using a docker container for builds?
Just in case anyone else ever finds this error via Google. We encountered this error because someone had missed a trailing forward slash from one of our NuGet feed URLs (hosted on ProGet) making it an invalid URL.