skip to Main Content

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


  1. You try it

    dotnet tool install –global dotnet-ef –source https://api.nuget.org/v3/index.json

    Login or Signup to reply.
  2. Firstly please check the %appdata%NuGetNuGet.Config(e.g C:UsersxxxAppDataRoamingNuGetNuGet.Config) if it contains correct package source:

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

    Or run command to check current entries:

    dotnet nuget list source
    

    Run the command below to clear the cache, then restart the project

    dotnet nuget locals -c all
    

    If still not working, a workaround is to use the --add-source parameter directly when installing to specify nuget.org as the source:

    dotnet tool install --global dotnet-ef --add-source https://api.nuget.org/v3/index.json
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search