title: Start WPF Application in Console Application
body: <p>Is it possible to start WPF Application in Console mode?</p>
  
  <pre><code>public partial class App : Application
  {
      public App()
      {
          InitializeComponent();
      }
  }
  
  &lt;Application x:Class="WPF.App"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  &lt;/Application&gt;
  
  [STAThread]
  static void Main(string[] args)
  {
    if (args.Length &gt; 0)
    {
       switch (args[0].ToLower())
       {
         case "/g": RunApplication(); break;
       }
    }
  }
  
  private static void RunApplication()
  {
      var application = new System.Windows.Application();
  
      application.Run(new App());
  }
  </code></pre>
  
  <p>It will show Argument type 'WPF.app' is not assignable to parameter type 'System.Windows.Window'.</p>
  
  <p>Any solution to work around it?? 
  Any different between </p>
  
  <p>1.public partial class App : Application</p>
  
  <p>2.public partial class App : Window</p>