C
C#12mo ago
Fexty

Can't install tools with `dotnet tool` command

When I try to install a dotnet tool from the terminal I always get an error. Example: dotnet tool install docfx -g Running this always gives me an exception with the following stacktrace:
Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageInstallerException: Package Source Mapping is enabled, but no source found under the specified package ID: docfx. See the documentation for Package Source Mapping at https://aka.ms/nuget-package-source-mapping for more details.
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.LoadNuGetSources(PackageId packageId, PackageSourceLocation packageSourceLocation, PackageSourceMapping packageSourceMapping)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation)
at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageInstallerException: Package Source Mapping is enabled, but no source found under the specified package ID: docfx. See the documentation for Package Source Mapping at https://aka.ms/nuget-package-source-mapping for more details.
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.LoadNuGetSources(PackageId packageId, PackageSourceLocation packageSourceLocation, PackageSourceMapping packageSourceMapping)
at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation)
at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
This happens with all packages I try to install. It's telling me something about source mappings, but I don't understand if I have it configured incorrectly, or if I straight up need to disable it or something? Very lost.
8 Replies
Fexty
FextyOP12mo ago
Yes
phaseshift
phaseshift12mo ago
Package Source Mapping
Describes package source mapping functionality and how to onboard
Fexty
FextyOP12mo ago
I have read through it but I only understand a fraction of what is being said I changed the source mapping in VS for * to nuget.org but if I'm being honest I don't even know what that's supposed to do I have seen one person report this problem and their "fix" was reinstalling windows
Mayor McCheese
Mayor McCheese12mo ago
Just out of curiosity open a cli tool and make a new directory, go into that directory and type "dotnet new nugetconfig"
Fexty
FextyOP12mo ago
The command ran and created this config
Fexty
FextyOP12mo ago
Disable what? Source mapping?
Fexty
FextyOP12mo ago
I don't understand. When I look at the package using the VS nuget package manager it even says "Package source mapping found"
No description
Fexty
FextyOP12mo ago
But I can't install it from there because it's a tool
Want results from more Discord servers?
Add your server