I want to implement the command line run in a WPF project. The entry points has been changed in the App.cs. But the console will only blink and then disappear. How to fix that? Thanks
public class App : System.Windows.Application { [STAThread] static void Main(string[] args) { if (args.Length > 0) {// Commandline run mode // Command line given, console from console Console.WriteLine("In cmd line mode"); AllocConsole(); CmdLineRun.ParseArgs(args); CmdLineRun.CmdRun(); } else {// GUI mode GUIMain(); } } static void GUIMain() { App app = new App(); app.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative); app.Run(); } [System.Runtime.InteropServices.DllImport("kernel32.dll")] private static extern bool AllocConsole(); }