본문 바로가기
Windows/C#/WPF

[WPF] Main 메소드 호출

by hirudev 2022. 5. 11.

https://stackoverflow.com/questions/2694680/no-main-in-wpf

 

The Main() method is created automatically. If you want to provide your own you have to (tested in VS2013, VS2017 and VS2019):

  • Right-click App.xaml in the solution explorer, select Properties
  • Change 'Build Action' to 'Page' (initial value is 'ApplicationDefinition')

Then just add a Main() method to App.xaml.cs. It could be like this:

[STAThread]
public static void Main()
{
    var application = new App();
    application.InitializeComponent();
    application.Run();
}

 

댓글