安装 Asp.net 核心运行时无法在 ubuntu linux 操作系统上运行

Posted

技术标签:

【中文标题】安装 Asp.net 核心运行时无法在 ubuntu linux 操作系统上运行【英文标题】:Install Asp.net core Runtime not working on ubuntu linux OS 【发布时间】:2020-10-09 01:25:26 【问题描述】:

我尝试在 linux ubuntue 18.4 lts 上安装 asp.net core 3.1 运行时并使用此命令安装 asp.net core 运行时。

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y aspnetcore-runtime-3.1

之后,所有东西都安装好了,但是当我想在 ubuntu os 上检查 asp.net 核心版本时,我运行这个命令

dotnet --version

我收到以下消息我不知道我没有安装 asp.net core SDK 我需要安装 Runtime 来运行我的网站

dotnet --version
  It was not possible to find any installed .NET Core SDKs
  Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
      https://aka.ms/dotnet-download

【问题讨论】:

【参考方案1】:

dotnet是CLI,是the .NET Core SDK.自带的CLI接口驱动,所以需要install it:

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-3.1

您只安装了运行使用 ASP.NET Core 制作的应用程序所需的运行时,但不包括运行时本身。

【讨论】:

所以我应该只安装 SDK 还是两者都安装? @MR_WELL 取决于您的需要。如果你要开发一些 .NET 的东西,你最好安装 SDK(AFAIK 它包括运行时)。如果您只想运行已创建和编译的应用程序 - 运行时应该没问题。

以上是关于安装 Asp.net 核心运行时无法在 ubuntu linux 操作系统上运行的主要内容,如果未能解决你的问题,请参考以下文章