The*_*ias 7 c# .net-core visual-studio-2019
当我在Visual Studio社区2019(版本16.3.1)中使用Ctrl + F5(无需调试就开始)启动控制台应用程序(.NET Core)时,以下消息将附加在控制台窗口的末尾:
C:\ HelloWorld \ bin \ Debug \ netcoreapp3.0 \ HelloWorld.exe(进程1672)退出,代码为0。
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Run Code Online (Sandbox Code Playgroud)
有什么方法可以防止Visual Studio 2019打印此消息?我尝试通过更改以下选项来防止该解决方案出现在“输出”窗口中,该选项包括:“工具”>“选项”>“调试”>“输出”窗口>“进程退出消息” =“关闭”,但是在控制台窗口中无效。
注意:此消息不会在Visual Studio 2017中显示。它只会在Visual Studio 2019中显示,并且仅在.NET Core应用程序中显示。
您可以通过检查Tools > Options > Debugging > General > Automatically close the console when debugging stops选项来禁用它:
正如控制台本身所述(Visual Studio 2019 v16.3.2):
这将使控制台只Press any key to continue...通过在不调试的情况下启动(CTRL+ F5)而不是退出代码(仍然保持控制台打开)来打印:
| 归档时间: |
|
| 查看次数: |
263 次 |
| 最近记录: |