【问题标题】:dotnet tool install --global dotnet-efdotnet 工具安装 --global dotnet-ef
【发布时间】:2021-07-20 03:53:39
【问题描述】:

错误 NU1100:无法解析“net5.0”的“dotnet-ef (>= 0.0.0)”。 错误 NU1100:无法解析 'net5.0/any' 的 'dotnet-ef (>= 0.0.0)'。 无法恢复工具包。 工具 'dotnet-ef' 安装失败。此故障可能是由以下原因引起的:

  • 您正在尝试安装预览版,但未使用 --version 选项指定版本。
  • 找到了同名的包,但它不是 .NET 工具。
  • 无法访问所需的 NuGet 源,可能是因为 Internet 连接问题。
  • 您输入错误的工具名称。

更多原因,包括包命名强制,请访问https://aka.ms/failure-installing-tool 错误 NU1100:无法为“net5.0”解析“dotnet-aspnet-codegenerator (>= 0.0.0)”。 错误 NU1100:无法解析 'net5.0/any' 的 'dotnet-aspnet-codegenerator (>= 0.0.0)'。 无法恢复工具包。 工具 'dotnet-aspnet-codegenerator' 安装失败。此故障可能是由以下原因引起的:

  • 您正在尝试安装预览版,但未使用 --version 选项指定版本。
  • 找到了同名的包,但它不是 .NET 工具。
  • 无法访问所需的 NuGet 源,可能是因为 Internet 连接问题。
  • 您输入错误的工具名称。

【问题讨论】:

    标签: .net visual-studio-code


    【解决方案1】:

    dotnet nuget list source 返回一个空列表。 我猜你只有在安装 dotnet 时才会遇到这个问题,而你的机器上没有安装 Visual Studio,它预先填充了官方 nuget 站点作为源。

    运行 dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org 为我解决了这个问题。

    https://github.com/dotnet/EntityFramework.Docs/issues/2044#issuecomment-910202971

    【讨论】:

    • 谢谢,这是我的问题。
    【解决方案2】:

    将它安装在您的本地项目而不是全局项目中,它将为我工作。将以下命令一一执行:

    1. dotnet new tool-manifest(这将在您的项目中添加 dotnet-tools.json 文件)
    2. dotnet tool install --local dotnet-ef --version 5.0.5
    3. dotnet ef

    【讨论】:

      猜你喜欢
      • 2022-09-24
      • 2022-01-08
      • 2022-11-02
      • 2023-03-03
      • 2022-07-06
      • 2019-01-29
      • 2019-02-27
      • 1970-01-01
      • 2020-08-28
      相关资源
      最近更新 更多