按照以下说明安装.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(字符串文件名, String [] argv,String [] envp,String cwd,布尔redirectStdin, 布尔redirectStdout,布尔Boolean redirectStderr,布尔 setCredentials,UInt32 userId,UInt32 groupId,UInt32 []组,Int32& stdinFd,Int32&stdoutFd,Int32&stderrFd,布尔值使用终端, 布尔throwOnNoExec)在 System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)位于 System.Diagnostics.Process.Start()位于 microsoft.DotNet.Cli.Utils.Command.Execute()在 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>