简体   繁体   English

C# Ubuntu 终端的 Dotnet 运行问题

[英]C# Dotnet Run Issue with Ubuntu Terminal

I am attempting to setup .net on my linux machine to do some C# coding practice but I have run into a very frustrating issue.我正在尝试在我的 linux 机器上设置 .net 来做一些 C# 编码练习,但我遇到了一个非常令人沮丧的问题。

My terminal refuses to display Console.WriteLine() functions.我的终端拒绝显示 Console.WriteLine() 函数。 Even a simple hello world.甚至是一个简单的hello world。 Using the command dotnet run just hangs for a few seconds and then sends me to the next line waiting for another command.使用命令dotnet run只需挂起几秒钟,然后将我发送到下一行等待另一个命令。 I know the runtime is working because if I intentionally write a coding error the terminal displayed the error.我知道运行时正在运行,因为如果我故意编写编码错误,终端会显示错误。 I'm getting extremely frustrated with this.我对此感到非常沮丧。

I've also tried using VSCode and the terminal in that (Yeah i get its essentially the same thing) but it does the same thing on dotnet run hangs for a second and then just proceeds to the next line.我也尝试过使用 VSCode 和终端(是的,我得到了它本质上相同的东西)但它在dotnet run上做同样的事情会挂起一秒钟,然后继续下一行。 I feel like the output is coming out somewhere but I'm not sure where.我觉得 output 出现在某个地方,但我不确定在哪里。

Host:主持人:

Version: 6.0.0版本:6.0.0

Commit: 4822e3c3aa提交:4822e3c3aa

.NET SDKs installed: .NET SDK 已安装:

6.0.100 [/snap/dotnet-sdk/150/sdk] 6.0.100 [/snap/dotnet-sdk/150/sdk]

.NET runtimes installed: .NET 运行时安装:

Microsoft.AspNetCore.App 6.0.0 [/snap/dotnet-sdk/150/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [/snap/dotnet-sdk/150/shared/Microsoft.AspNetCore.App]

Microsoft.NETCore.App 6.0.0 [/snap/dotnet-sdk/150/shared/Microsoft.NETCore.A Microsoft.NETCore.App 6.0.0 [/snap/dotnet-sdk/150/shared/Microsoft.NETCore.A

Console.WriteLine("Hello World!"); 

The code running in terminal is在终端中运行的代码是

dotnet run

This behavior is already noticed in any linux distribution, I already see it in Debian.在任何 linux 发行版中都已经注意到了这种行为,我已经在 Debian 中看到了它。 Is about the time needed of the main pid to compile and get the references of self contained distributable.大约是主 pid 编译和获取自包含可分发的引用所需的时间。 The solution in consideration is install the needed libraries in the system prior to the execution, but the time of processing is still not the same than in Windows.考虑的解决方案是在执行之前在系统中安装所需的库,但处理时间仍然与 Windows 中的不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM