Where is the Main() function hidden with WPF project file from VS2010? [duplicate]

独自空忆成欢 提交于 2019-12-11 04:26:53

问题


Possible Duplicate:
No Main() in WPF?

This is the code for Main() in WPF programming.

[STAThread]
public static void Main()
{
  Window win = new Window();
  ....

  Application app = new Application();
  app.Run(win);
}

However, when I tried to use VS2010 to make WPF Application.

I can't find the Main(), but public MainWindow().

Why is the Main() function hidden? How can I get the Main() when I use VS2010 WPF project?


回答1:


The entry point is in App.xaml.cs. In there you could also override the OnStartup and pass in the cmd line arguments, if thats what you were wanting to do.

As others have mentioned, the question here answers what you are after.




回答2:


It is in .\obj\BuildConfiguration\app.g.cs

You can easily navigate to it by opening app.xaml.cs and use the right combobox above the source code to select the (grayed = resides in another partial-class file) main method.




回答3:


Main() is generated during compilation.Find it in App.g.cs in obj/{Debug,Release} folder



来源:https://stackoverflow.com/questions/7946672/where-is-the-main-function-hidden-with-wpf-project-file-from-vs2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!