如何解决 .NET 中包映射上下文中的“找不到源”错误

问题描述 投票:0回答:1

这是我从 Dotner CLI 安装任何类型的包时遇到的错误。有什么办法可以解决这个问题吗?感谢所有解决方案!!

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)

我试过了:

dotnet nuget locals all --clear
dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org

但这些似乎都不起作用。

c# asp.net .net asp.net-core nuget-package
1个回答
0
投票

你试试

dotnet 工具安装 --global dotnet-ef --source https://api.nuget.org/v3/index.json

© www.soinside.com 2019 - 2024. All rights reserved.