Why is the console window closing immediately once displayed my output?

前端 未结 21 2522
死守一世寂寞
死守一世寂寞 2020-11-22 03:45

I\'m studying C# by following the guides in MSDN.

Now, I just tried the Example 1 (here is the link to MSDN), and I\'ve encountered an i

21条回答
  •  轮回少年
    2020-11-22 04:11

    I'm a little bit late to the party, but: in Visual Studio 2019 for .NET Core projects the console doesn't close automatically by default. You can configure the behaviour through menu Tools → Options → Debugging → General → Automatically close the console when debugging stops. If you get your console window automatically closing, check if the mentioned setting is not set.

    The same applies to the .NET Framework new style console projects:

    
    
      
        Exe
        net472
      
    
    
    

    The old style .NET Framework project still unconditionally close the console at the end (as of Visual Studio 16.0.1).

    Reference: https://devblogs.microsoft.com/dotnet/net-core-tooling-update-for-visual-studio-2019-preview-2/

提交回复
热议问题