dotnet tool install --local takes .config/nuget.config instead of nuget.config in current working directory
See original GitHub issueDescribe 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
- Create a simple empty project in ~/my-dotnet-project
- Create a tool manifest with
dotnet new tool-manifest
- Create a valid nuget.config in ~/my-dotnet-project/.config/ folder
- 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)
- Create a valid nuget.config in the ~/my-dotnet-project/
- 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:
- Created 2 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top 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 >
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
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.
Wow, I’m sorry I missed that. I’ll try to respond to it with locations/patterns for making a test.