程序不包含适用于入口点的静态“主”方法
我知道对这个问题有很多疑问,但我的问题最糟糕。 我有一个包含很多WPF应用程序的大项目。 错误的是我已经删除了App.xaml,现在我在构建中有错误。我尝试的是备份App.xaml,甚至当我再次把它放在我的项目中时,我仍然遇到了这个错误。 该怎么办 ? 谢谢。
在文件属性中,将Build Action设置为ApplicationDefinition
:
这将在中间输出文件(obj / App.g.cs)中为您生成Main
方法:
/// /// Application Entry Point. /// [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(); }