Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choosing DotNet Restore Package Source #6295

Closed
darrensimio opened this issue Jun 1, 2016 · 3 comments
Closed

Choosing DotNet Restore Package Source #6295

darrensimio opened this issue Jun 1, 2016 · 3 comments

Comments

@darrensimio
Copy link

Steps to reproduce

Not sure if anyone have encountered this issue, where dotnet restore is not restoring from nuget.org, instead it is restoring from other another source from my list of package sources.

Following's how my NuGet.Config looks like:
<?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="Custom-AD" value="http://server1/httpAuth/app/nuget/v1/FeedService.svc/" /> <add key="Custom" value="http://server2:8080/guestAuth/app/nuget/v1/FeedService.svc/" /> </packageSources> <activePackageSource> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> </activePackageSource> </configuration>

What i did was simply:

  • dotnet new
  • dotnet restore

This is when things broke for me. It works on another environment I had where there is only 1 package source.

I was wondering if this is due to the fact that I have private sources? And is there anyway for me to select which sources I want to include / exclude?

Actual behavior

log : Restoring packages for C:\play\core-a\project.json...
info : GET http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App'
info : GET http://server2:8080/guestAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App'
info : NoContent http://server2:8080/guestAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App' 31ms
info : Unauthorized http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App' 140ms
info : GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json
log : Retrying 'FindPackagesByIdAsyncCore' for source 'http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App''.
log : Response status code does not indicate success: 401 (Unauthorized).
info : GET http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App'
info : Unauthorized http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App' 139ms
log : Retrying 'FindPackagesByIdAsyncCore' for source 'http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App''.
log : Response status code does not indicate success: 401 (Unauthorized).
info : GET http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App'
info : Unauthorized http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App' 144ms
error: Failed to retrieve information from remote source 'http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App''.
error: Response status code does not indicate success: 401 (Unauthorized).
error: Failed to retrieve information from remote source 'http://server1/httpAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.App''.
error: Response status code does not indicate success: 401 (Unauthorized).

Environment data

.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
Version: 1.0.0-preview1-002702
Commit Sha: 6cde21225e

Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64

@darrensimio
Copy link
Author

Found a workaround for this, simply create a NuGet.config file in the project directory which contains the following:

<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <!--To inherit the global NuGet package sources remove the <clear/> line below --> <clear /> <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" /> <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" /> </packageSources> </configuration>

@darrensimio
Copy link
Author

This can be marked as closed.

@ivaylo5ev
Copy link

I had a similar issue running dotnet restore on the dotnet sdk 2.1.4 when using Paket (v5.133) to manage my dependencies. I received the following error:

error NU1101: Unable to find package ???. No packages exist with this id in source(s): dotnet-core,
nuget.org

The cause was bad packages cached by paket itself, To solve this, one has to clear the cache by running:

paket clear-cache

Alternatively, you can manually delete the contents of the cache folder C:\Users\%USERNAME%\.nuget\packages if on Windows.

You may want to close any Visual Studio instances as they may prevent the purging of the cache directory.

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants