程序不包含适合入口点的静态“main"方法 [英] program doesn't contain a static 'main' method suitable for an entry point

查看:36
本文介绍了程序不包含适合入口点的静态“main"方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道对此问题有很多疑问,但我的问题最严重.我有一个包含很多 WPF 应用程序的大项目.我错误地删除了App.xaml,现在我在构建中出错了.我尝试采取备份App.xaml,即使我再次将其放入我的项目中,我仍然出现此错误.该怎么办 ?谢谢.

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.

推荐答案

在文件属性中,将Build Action设置为ApplicationDefinition:

In the file properties, set Build Action to ApplicationDefinition:

这将在中间输出文件 (obj/App.g.cs) 中为您生成一个 Main 方法:

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();
}

这篇关于程序不包含适合入口点的静态“main"方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆