WPF开发“Program '*' does not contain a static 'Main' method suitable for an entry point”错误

WPF项目编译时出现“Program '*' does not contain a static 'Main' method suitable for an entry point”错误,

  解决方法:

   自定义一个静态入口 

   然后 项目属性 -》 应用程序 -》启动对象 ,选择新创建的这个静态类

   示例代码:

    public static class Program
    {
        [System.STAThreadAttribute()]
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]//固定写法
        public static void Main()
        {
            //WPF项目的Application实例,用来启动WPF项目的(ThermometerControl就是你的项目名字)
            ThermometerControl.App app = new ThermometerControl.App();
            app.InitializeComponent();
            app.Run();
        }
    }
原文地址:https://www.cnblogs.com/bsyblog/p/8703257.html