This is the error I’m facing while intalling any kind of package from the Dotner CLI. Is there any way to resolve this. All solution are appreaciated!!
dotnet tool install --global dotnet-ef
Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageInstallerException: Package Source Mapping is enabled, but no source found under the specified package ID: dotnet-ef. 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)
I tried :
dotnet nuget locals all --clear
dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org
But none of this seems to work.
2
Answers
You try it
dotnet tool install –global dotnet-ef –source https://api.nuget.org/v3/index.json
Firstly please check the
%appdata%NuGetNuGet.Config
(e.gC:UsersxxxAppDataRoamingNuGetNuGet.Config
) if it contains correct package source:Or run command to check current entries:
Run the command below to clear the cache, then restart the project
If still not working, a workaround is to use the
--add-source
parameter directly when installing to specify nuget.org as the source: