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 tool install have trouble installing when an private feed is in nuget.config

See original GitHub issue

@DerAlbertCom commented on Fri Jun 29 2018

Issue Title

dotnet tool install -g foobar does not install any tool if private nuget feed is in the nuget.config which requires authentication.

General

I tried ‘dotnet tool install -g sourcelink’, and have in the the global nuget.config the company nuget feed from vsts.

C:\Program Files\dotnet\sdk\2.1.301\NuGet.targets(114,5): error : Fehler beim Abrufen von Informationen zu "sourcelink" aus der Remotequelle "https://XYZ.pkgs.visualstudio.com/_packaging/172bc92f-50b3-48bc-b4cf-9555b7f0fd10/nuget/v3/flat2/fo/index.json". [C:\Users\DerAl\AppData\Local\Temp\ctdjxp0q.bbs\restore.csproj]
C:\Program Files\dotnet\sdk\2.1.301\NuGet.targets(114,5): error :   Response status code does not indicate success: 401 (Unauthorized). [C:\Users\DerAl\AppData\Local\Temp\ctdjxp0q.bbs\restore.csproj]

If i comment out the private feed out in then nuget.config, then the tool get’s installed.

nuget restore has not problem with the nuget feed. dotnet restore (which should not be used with VSTS because you have to store a Cleartext PAT in the nuget.config) clearly has the same problem like dotnet tool

Possible Workaround

See https://github.com/dotnet/sdk/issues/9555#issuecomment-802015061 in this issue discussing --ignore-failed-sources.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:45
  • Comments:60 (3 by maintainers)

github_iconTop GitHub Comments

66reactions
DerAlbertComcommented, Feb 15, 2019

Really? A Workaround? Why not just fix this. dotnet cli with authenticated feeds is a mess.

  • not all commands accessing nuget feeds support --interactive
  • –interactive does not work in newer sdks, because the logging of the needed oauth2 device flow information is swallowed.
  • not all dotnet task in AzureDevOps supports selecting a Azure Artifact source

I’m really tired of this problems around the authenticated nuget feeds. For this reason we can not use Hosted Build Agents in Azure DevOps. We have to use a own Build Agent with CLEARTEXT Credentials in the config file.

We cannot use dotnet cli correctly from the command line on the dev machine without put the cleartext credentials in the dev machines.

Yes, for all this problems are issues filed, mostly with no information when it will be fixed, or zero reaction.

49reactions
BenjaminAbtcommented, Apr 18, 2019

My workaround because I also run in this issue on Azure DevOps (current VS2017 and VS2019 and Ubuntu with NuGet 4.9.4 and 5.0.0):

Create a single NuGet.config with only the nuget.org feed (you can also name it like NuGet-OfficialOnly.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Now I am able to install via dotnet tool

Run

dotnet tool install --global GitVersion.Tool --version 5.0.0-beta2-65 --configfile NuGet-OfficialOnly.config
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to install dotnet tool from private nuget feed
I have a dotnet tool that is published as a Nuget package to a private feed. From a YAML pipeline I would like...
Read more >
dotnet tool install command - .NET CLI
The dotnet tool install command installs the specified .NET tool on your machine. ... For more information, see Common NuGet Configurations.
Read more >
Install dotnet global tool with private NuGet feed - Matt DuFeu
In this post I show how to solve a 401 Unauthorised error while installing a .NET Global Tool and you have a private...
Read more >
Cannot install anything using dotnet tool install command
In my case, it was failing because I have a private feed, which needs authentication (despite that configured in nuget.config).
Read more >
NuGet problems when installing X
When I try to install the X tools for ServiceStack, I get a strange NUGET error for my private MyGet repo. I have...
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