如何修复 .NET Core: Could not execute because the application was not found or a compatible .NET SDK is not installed.

问题:

你正在尝试运行 .NET core 命令,例如

example-3.sh

但你看到此错误消息:

example-2.txt
Possible reasons for this include:
  * You intended to execute a .NET program:
      The application 'new' does not exist.
  * You intended to execute a .NET SDK command:
      It was not possible to find any installed .NET SDKs.
      Install a .NET SDK from:
        https://aka.ms/dotnet-download

解决方案

你没有安装 .NET Core SDK,只安装了 .NET Core 主机。

使用例如以下命令安装 SDK(此命令适用于 Debian 和 Ubuntu)

example-1.sh

你可能需要选择正确的版本(在此示例中为 5.0)。


Check out similar posts by category: C#