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 --local takes .config/nuget.config instead of nuget.config in current working directory

See original GitHub issue

Describe the bug

When you try to install a dotnet tool from current working directory and there is a ~/my-dotnet-project/.config/nuget.config file present, it will not take ~/my-dotnet-project/nuget.config in priority even if the documentation says that it should take it. https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-install#options

To Reproduce

  1. Create a simple empty project in ~/my-dotnet-project
  2. Create a tool manifest with dotnet new tool-manifest
  3. Create a valid nuget.config in ~/my-dotnet-project/.config/ folder
  4. Modify the packageSource URL of that .config/nuget.config file to something that will not work (to easily see that it will be that file that is taken in priority)
  5. Create a valid nuget.config in the ~/my-dotnet-project/
  6. Install a tool available on nuget.org like CycloneDX dotnet tool install --local CycloneDX from ~/my-dotnet-project/ current working directory

Observe an error like this:

:~/workspace/test-dotnet-webapi-nuget$ dotnet tool install --local CycloneDX
/usr/share/dotnet/sdk/5.0.404/NuGet.targets(131,5): error : Unable to load the service index for source https://api.nuget.org/v3-bug/index.json. [/tmp/xdqilbl3.x2b/restore.csproj]
/usr/share/dotnet/sdk/5.0.404/NuGet.targets(131,5): error :   Response status code does not indicate success: 404 (Not Found). [/tmp/xdqilbl3.x2b/restore.csproj]
The tool package could not be restored.
Tool 'cyclonedx' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool

Further technical details

.NET SDK (reflecting any global.json):
 Version:   5.0.404
 Commit:    72c68b830a

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.404/

Host (useful for support):
  Version: 5.0.13
  Commit:  b3afe99225

.NET SDKs installed:
  3.1.416 [/usr/share/dotnet/sdk]
  5.0.404 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.22 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.22 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dsplaistedcommented, Mar 2, 2023

The related PR has been merged, so I think we can close this. Feel free to comment / re-open if that’s not the case.

1reaction
baronfelcommented, Nov 20, 2022

Wow, I’m sorry I missed that. I’ll try to respond to it with locations/patterns for making a test.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nuget.config File Reference
Add a nuget.config file in the root of your project repository. ... NuGet packages instead of the default $(Solutiondir)/packages folder.
Read more >
dotnet tool install command - .NET CLI
Local tools are stored in the NuGet global directory, whatever you've set that to be. There are shim files in $HOME/.dotnet/toolResolverCache ...
Read more >
NuGet Configuration Inheritance
The interesting observation here is that all clients start with a NuGet.config in the current directory and then walk up to the drive...
Read more >
Install a dotnet tool from local source only
So I'm installing it from a local source feed as the tutorial recommends. dotnet tool install --tool-path /usr/bin --add-source path/to/nupkg ...
Read more >
Nuget with Artifactory. Key not valid for use in specified state
I had NuGet.config file located near NuGet.test.Config. ... We have a local nuget server at our company (created using free Nuget Server).
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