program doesn't contain a static 'main' method suitable for an entry point

混江龙づ霸主 提交于 2020-02-24 05:51:09

问题


I know that have a lot of question about this issue but my problem is worst. I have a big project that contains a lot WPF application. In mistake I have been deleted the App.xaml, and now I have error in the building.What I try is to take the backup App.xaml and even when I put it again in my project, and I still got this error. What to do ? Thanks.


回答1:


In the file properties, set Build Action to ApplicationDefinition:

This will generate a Main method for you in the intermediate output files (obj/App.g.cs):

/// <summary>
/// Application Entry Point.
/// </summary>
[System.STAThreadAttribute()]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public static void Main() {
    YourAppName.App app = new YourAppName.App();
    app.InitializeComponent();
    app.Run();
}


来源:https://stackoverflow.com/questions/26441289/program-doesnt-contain-a-static-main-method-suitable-for-an-entry-point

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