【问题标题】:Error when install dotnet/core/aspnet:3.1 on CentOS 8 - Folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders在 CentOS 8 上安装 dotnet/core/aspnet:3.1 时出错 - 文件夹 [/usr/share/dotnet/host/fxr] 不包含任何版本编号的子文件夹
【发布时间】:2020-12-23 10:46:17
【问题描述】:

像 dotnet/dotnet-docker#1537 但我在独立机器上的 CenOS 8(不是 Docker)上有同样的错误。 使用 2020 年 12 月 23 日的最新更新清洁新的 CentOS 8。 在控制台中:

sudo dnf install aspnetcore-runtime-3.1 - 好的

dotnet - OK(显示使用手册)

dotnet --info - 错误:

A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders

dotnet --list-runtimes - 错误: A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders

dotnet *.dll - 错误: A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders

文件夹/usr/share/dotnet/host/fxr 真的是空的。尝试安装 SDK - 无效

【问题讨论】:

    标签: .net asp.net-core .net-core centos8


    【解决方案1】:

    如果 dotnet sdk 是 5.0 版

    步骤 1.- 删除 sdk

    sudo dnf remove dotnet-sdk-5.0
    

    步骤 2.- 删除文件夹

    sudo rm -rf /usr/share/dotnet
    sudo rm -rf /usr/bin/dotnet
    sudo rm -rf /etc/yum.repos.d/microsoft-prod.repo
    

    步骤 4.- 清理和升级。

    sudo dnf clean all
    sudo dnf upgrade
    

    步骤 5.- 重启系统

    sudo init 6
    

    步骤 6.- 最后

    sudo dnf install dotnet-sdk-5.0
    

    【讨论】:

    • 使用 dotnet 5.0 一切正常,但答案是 3.1
    【解决方案2】:

    在将系统更新到 Fedora 32 后,我遇到了同样的问题。问题是,我之前安装了 dotnet-runtime-2.1,但 Fedora 32 附带了 3.1。

    如果您的 dotnet 应用程序与 3.1 兼容,您可以简单地卸载旧的运行时。我就是这样做的:

    1. 检查已安装的 dotnet 运行时:
    $ rpm -qa | grep dotnet
    dotnet-runtime-2.1-2.1.12-1.x86_64
    dotnet-runtime-deps-2.1-2.1.12-1.x86_64
    dotnet-hostfxr-2.1-2.1.12-1.x86_64
    dotnet-host-3.1.10-1.fc32.x86_64
    

    就我而言,2.1 版是我自己安装的。 3.1被系统安装(标记为fc32)

    1. 删除旧版本:
    dnf remove dotnet-runtime-2.1
    
    1. 要安装 2.1,我之前必须添加 microsoft repo,现在不再需要了:
    rm /etc/yum.repos.d/microsoft-prod.repo
    
    1. 由于某种未知原因,卸载 2.1 的同时也卸载了 3.1。像往常一样安装它:
     dnf install dotnet-runtime-3.1
    
    1. dotnet --info 应该可以再次使用。

    如需更多信息或您的应用程序需要 dotnet 2.1:

    https://github.com/dotnet/core/issues/4655

    【讨论】:

      猜你喜欢
      • 2023-01-19
      • 2022-09-30
      • 1970-01-01
      • 2016-12-10
      • 1970-01-01
      • 2020-04-23
      • 1970-01-01
      • 2021-03-27
      • 1970-01-01
      相关资源
      最近更新 更多