我正在尝试通过dotnet-cli安装dotnet-ef
工具。
我输入的命令:dotnet tool install --global dotnet-ef
我给我以下错误:
The tool package could not be restored.
Tool 'dotnet-ef' 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 Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
我正在使用dotnet 3.0,我相信我在MacOS上没有这个问题,我现在正在尝试在Windows 10计算机上执行相同的命令,这给了我这个错误。
使用dotnet --info
命令的一些信息:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
答案 0 :(得分:7)
我通过添加3.0.0
标志并将版本指定到dotnet tool install --global dotnet-ef --version 3.0.0
使其工作。
我使用的命令:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.OleDb.OleDbException: The record cannot be deleted or changed because table 'Items' includes related records.
答案 1 :(得分:2)
我对其进行了测试,并且效果很好。指定版本号。
dotnet tool install --global dotnet-ef --version 3.0.0
答案 2 :(得分:1)
dotnet tool install -g dotnet-ef --ignore-failed-sources
为我工作。感谢Anas-Alhariri
答案 3 :(得分:0)
我收到此错误消息,但是当我仔细检查所有错误时,我也遇到了:
Response status code does not indicate success: 407 (Proxy Authorization Required).
在运行命令时关闭代理可解决此问题。
答案 4 :(得分:0)
当我尝试从包管理器控制台而不是 Powershell 命令窗口运行推荐时出现此错误。
答案 5 :(得分:0)
我最近在 Mac OS 上遇到了同样的问题。 这与我们使用自己的 NuGet 提要(packageSources 部分)有关。 因此,我暂时从 NuGet.config 文件中删除了自定义 NuGet 提要,从而解决了这个问题。