Output Console.WriteLine from WPF Windows Applications to actual console

后端 未结 4 1217
青春惊慌失措
青春惊慌失措 2020-11-29 04:27

Background: I am struggling to add command line and batch processing capabilities to an existing WPF Windows Application. When I detect some options at startup I su

4条回答
  •  清歌不尽
    2020-11-29 05:04

    In the project properties, you can change the project type from a Windows application to a Console application, and AFAIK the only difference is that you get a console to use throughout the application's lifetime. I haven't tried it with WPF though.

    If you want to open and close a console, you should use Alloc/FreeConsole, but it is usually simpler to change the project type.

提交回复
热议问题