问题
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