Console application not closing

后端 未结 5 1321
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 06:38

I\'m developing a console application that is supposed to run under WinCE 6.0 and WinCE 7.0. I\'m using C#, Compact Fra

相关标签:
5条回答
  • 2021-02-07 06:46

    Try calling Application.Exit

    This works in windowed applications, and may force the console window to close.

    0 讨论(0)
  • 2021-02-07 06:47

    Are you putting you .exe file in Arguments property of ProcessStartInfo ? If you must do that, I believe that you're using CMD in FileName property, so you must use /K before your .exe name. Or just put in FileName the .exe path. You can clarify a lot if you put the code that calls your application.

    0 讨论(0)
  • 2021-02-07 06:47

    Try this:

    Tools > Options > Debugging > Automatically Close the Console When Debugging Stops

    0 讨论(0)
  • 2021-02-07 07:00

    try this code:

    Environment.Exit(0);
    
    0 讨论(0)
  • 2021-02-07 07:03

    I had exactly the same problem. Running console app on Beckhoff PLC which never closed.

    Instead of creating Console app I created Windows App. My code stayed the same as for console app. I just commented out:

    // Application.Run(new Form1());
    

    Seems now codes run without opening a form.

    0 讨论(0)
提交回复
热议问题