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();
}
}
posted on 2018-04-03 03:05 CodeArtist 阅读(689) 评论(0) 收藏 举报
浙公网安备 33010602011771号