[英]How do I stop the console window from closing in Visual studio 2019?
I have had this problem for a while but I haven't used Visual studio in ages.这个问题我已经有一段时间了,但我已经很久没有使用 Visual Studio 了。 But now I just want to solve this issue.
但现在我只想解决这个问题。
I'm following a F# course at school and i try to follow along with my teachers coding session.我正在学校学习 F# 课程,我尝试跟随我的老师编码 session。 This is the code
这是代码
module Program
open System
let incr =
fun x ->
x + 1
[<EntryPoint>]
let main argv =
let res = incr 5
printfn "My result is %d and I print a random number %d" res 5
0
When I hit F5 or press start the window pops up real quick, no output is shown and it closes instantly.当我按 F5 或按开始时,window 会快速弹出,没有显示 output 并立即关闭。 I was reading on other similar posts that you had to disable
我正在阅读您必须禁用的其他类似帖子
tools>options>debugging>Automatically close the console when debugging stops
But it was already unchecked, then I read about that you have to set "subsystem to console" but I tried to look this up but I couldn't find anything about this that I could make sense off.但它已经被取消选中,然后我读到你必须将“子系统设置为控制台”,但我试图查找它,但我找不到任何我可以理解的东西。
I'm just trying to do my homework and I really want to fix this problem so I can start using Visual studio again.我只是在做作业,我真的很想解决这个问题,这样我就可以再次开始使用 Visual Studio。
If possible, make the project type you create an F# .NET Core console app (which should be the first F# template in the New Project dialog).如果可能,将您创建的项目类型设为 F# .NET Core 控制台应用程序(这应该是“新建项目”对话框中的第一个 F# 模板)。 This uses a different system under the hood where the console window stays open and is re-used by subsequent runs.
这在引擎盖下使用了不同的系统,其中控制台 window 保持打开状态并供后续运行重复使用。
Also a possibility, if your application is just for exploring.如果您的应用程序只是为了探索,也是一种可能性。 For production apps I'd go for Phillip Carter's answer.
对于生产应用程序,我将 go 用于 Phillip Carter 的回答。
[<EntryPoint>]
let main argv =
...
Console.ReadKey() |> ignore
0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.