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

dotnet Initialization fails with multiple nuget sources #8299

Closed
nasfra opened this issue May 24, 2017 · 16 comments
Closed

dotnet Initialization fails with multiple nuget sources #8299

nasfra opened this issue May 24, 2017 · 16 comments

Comments

@nasfra
Copy link

nasfra commented May 24, 2017

Steps to reproduce

I am running dotnet version 1.0.4.
I have the following nuget configuration file in folder C:\Program Files (x86)\NuGet\Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSource>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="syncfusion" value="http://nuget.syncfusion.com/aspnet" />
  </packageSource>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
</configuration>

I am trying to install a new template, Fable.Template. I run the following command

dotnet new -i Fable.Template::*

Expected behavior

I would expect the Fable.Template package to be downloaded from the first soure (nuget.org) and installed.

Actual behavior

nuget is ignoring the first source declared in the nuget.config file (the nuget source) and is attempting to download the packages from the second source (syncfusion).

I get the following error

Restoring packages for C:\Users\user.folder\.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj...
Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnet/FindPackagesById()?id='Microsoft.NETCore.Targets''.
Response status code does not indicate success: 500 (Internal Server Error).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnet/FindPackagesById()?id='Fable.Template''.
Response status code does not indicate success: 500 (Internal Server Error).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnet/FindPackagesById()?id='Microsoft.NETCore.Targets''.
Response status code does not indicate success: 500 (Internal Server Error).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnet/FindPackagesById()?id='Fable.Template''.
Response status code does not indicate success: 500 (Internal Server Error).
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Failed to retrieve information about 'Fable.Template' from remote source 'http://nuget.syncfusion.com/aspnet/FindPackagesById()?id='Fable.Template''.\r [C:\Users\user.folder.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Response status code does not indicate success: 500 (Internal Server Error). [C:\Users\user.folder.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj]

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.4)

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

Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.4

@nasfra nasfra changed the title Initialization fails with miultiple nuget sources dotnet Initialization fails with multiple nuget sources May 24, 2017
@livarcocc
Copy link
Contributor

I don't believe this is a location that nuget looks for when trying to find NuGet.Config files: C:\Program Files (x86)\NuGet\Config.

@emgarten to confirm.

@nasfra
Copy link
Author

nasfra commented May 24, 2017

I checked the entire drive and there is a bunch of nuget.config files to be found! They either have the same content as in C:\Program Files (x86)\NuGet\Config or contain only a single node:

<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
</configuration>

Looking at fiddler output I can see the process of dotnet ignoring the other available packageSources.

Thanks for the help with this!

@emgarten
Copy link
Member

@nasfra run nuget.exe sources from the project folder to see all package sources discovered.
http://dist.nuget.org/index.html

You may need to copy the NuGet.Config file you pasted to %appdata%/NuGet/NuGet.Config which is the default location that restore will use to find sources.

@nasfra
Copy link
Author

nasfra commented May 26, 2017

The details of my setting are:

  • Windows 10
  • Visual Studio 2015 installed
  • Visual Sutdio 2017 installed
  • This is the first project I attempt to do using the command line/dotnet
  • I am trying to use the templates created by Fable, start reading at How do I start?

I don't have a project in my folder yet, since I am trying to create one.

Nuget is not in my path, so I just ran the nuget.exe resources from a .net project and I receive the following output

Registered sources:

  1. nuget.org [active]
    https://www.nuget.org/api/v2/
  2. syncfusion [active]
    http://nuget.syncfusion.com/aspnet
  3. Microsoft Visual Studio Offline Packages [active]
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

The %appdata/NuGet/NuGet.Config file is available. It has the following node:

  <packageSources>
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
    <add key="syncfusion" value="http://nuget.syncfusion.com/aspnet" />
  </packageSources>

Thank you for your help on this!

@emgarten
Copy link
Member

@nasfra remove syncfusion from your packageSources, it looks like it is having problems. From the Fable guide it doesn't look like this is needed for Fable.

@nasfra
Copy link
Author

nasfra commented May 30, 2017

Removing SyncFusion from my sources works in this case, but isn't really practical! I need SyncFusion for my work: visual Studio needs it, build scripts need it, etc. If I remove SyncFusion source form the config file, it is no longer available to all these resources.

@emgarten
Copy link
Member

@nasfra this looks like an issue with syncfusion, have you contacted them to find out what might be wrong?

@livarcocc
Copy link
Contributor

Closing this issue since this seems to have been resolved and we haven't had activity here in a while. Re-activate if that's not the case.

@Stefanpu13
Copy link

Stefanpu13 commented Oct 18, 2017

Hi, the same error appears on my machine, too:

I have the following sources (retrieved by nuget sources):

  1. nuget.org [Enabled]
    https://api.nuget.org/v3/index.json
  2. Genscape_local [Enabled]
    http://genbuild02.genscape.com:8181/artifactory/api/nuget/genscape-internal-nuget-local
  3. Genscape_debug [Enabled]
    http://genbuild02.genscape.com:8181/artifactory/api/nuget/genscape-internal-nuget-debug
  4. Microsoft Visual Studio Offline Packages [Enabled]
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

run dotnet new -i Fable.Template and result:

Restoring packages for C:\Users\stefan.uzunov.SCALEFOCUS.templateengine\dotnetcli\v2.0.0\scratch\restore.csproj...
Retrying 'FindPackagesByIdAsyncCore' for source 'http://genbuild02.genscape.com:8181/artifactory/api/nuget/genscape-internal-nuget-debug/FindPackage
sById()?id='Fable.Template''.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://genbuild02.genscape.com:8181/artifactory/api/nuget/genscape-internal-nuget-debug/FindPackage
sById()?id='Fable.Template''.
Response status code does not indicate success: 404 (Not Found).
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Failed to retrieve information about 'Fable.Template' from remote source 'http://genbu
ild02.genscape.com:8181/artifactory/api/nuget/genscape-internal-nuget-debug/FindPackagesById()?id='Fable.Template''. [C:\Users\stefan.uzunov.SCALEFOCU
S.templateengine\dotnetcli\v2.0.0\scratch\restore.csproj]
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Response status code does not indicate success: 404 (Not Found). [C:\Users\stefan.uz
unov.SCALEFOCUS.templateengine\dotnetcli\v2.0.0\scratch\restore.csproj]

dotnet SDK - 2.0.0

Edit:
On my personal PC, where there are no other sources the command runs fine.

@livarcocc
Copy link
Contributor

It seems like you have a feed that is not correct and that NuGet cannot find, therefore failing restore. Do you actually need the feed that's failing?

@Stefanpu13
Copy link

Stefanpu13 commented Oct 19, 2017

Hi, thanks for the suggestion.
Trying will other templates also fails (ruled out problem with fable template)
Disabling the sources from VS-> Options -> NUGet Package Manager did not help (though it modified the global Nuget.Config file)
Deleting the sources from the global Nuget.Config file helped.
However, I still think that it is better to try all sources even if some of them fail - after all, my Nuget.Config`s "packageSources" tag has 3 keys, but only two of them were tested

@richardwhatever
Copy link

I get problem too.

@ckpearson
Copy link

Yeah, this is happening for me too.

<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="CliFallbackFolder" value="C:\Users\Clint\.dotnet\NuGetFallbackFolder" />
<add key="[SECRET]" value="[SECRET]" />

I need the [SECRET] source for some client work, and I clearly have the primary feed configured, so my only guess is that it's trying the private feed and kak'ing itself when it fails and then just bails.

The console output is basically just it retrying loads to find the package in the private feed and getting a 401 and freaking out.

This is for the Giraffe template.

@ckpearson
Copy link

Only workaround I've found for now is to temporarily comment out the offending source and run the install.

Obviously the desired behaviour should be that if any feed fails it moves on and tries the others, as I shouldn't need to specify the feed credentials unless I'm absolutely looking for a package in that feed.

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@VGerris
Copy link

VGerris commented Jun 29, 2020

why is this closed? I see also on Linux and mostly in Docker containers.
It's a simply description of sources, it shoud just work.

@whighsmith
Copy link

This issue is happening on my machine using Visual Studio 2022 LTSC 17.4. I'm not wasting time providing details since this thread is closed.

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

8 participants