首页 > 解决方案 > 在 ubuntu 19.10 上安装 .NET 核心后无法运行示例控制台应用程序

问题描述

根据以下说明安装 .NET core sdk 后:

https://dotnet.microsoft.com/download/linux-package-manager/ubuntu19-04/sdk-current

我使用 dotnet new console. 运行dotnet run给出以下错误:

System.ComponentModel.Win32Exception(2):没有那个文件或目录
在 System.Diagnostics.Process.ForkAndExecProcess(字符串文件名,字符串 [] argv,字符串 [] envp,字符串 cwd,布尔重定向标准输入,布尔重定向标准输出,布尔重定向标准错误,布尔 setCredentials,UInt32 用户 ID,UInt32 组 ID,UInt32 [] 组,Int32 和标准输入, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at Microsoft.DotNet.Cli.Utils.Command.Execute() at Microsoft.DotNet.Tools.Run.RunCommand.Execute() 在 Microsoft.DotNet.Tools.Run.RunCommand.Run(String[] args) 在 Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)在 Microsoft.DotNet.Cli.Program.Main(String[] args)

我的dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  19.10
 OS Platform: Linux
 RID:         ubuntu.19.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.100/

Host (useful for support):
  Version: 3.0.0
  Commit:  95a0a61858

.NET Core SDKs installed:
  3.0.100 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

请注意,我的版本是 19.10。这真的是原因吗?

*.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

</Project>

标签: c#ubuntu.net-coresdk

解决方案


推荐阅读