WPF没有入口点

时间:2018-06-13 14:09:13

标签: c# wpf xaml sharpdevelop entry-point

我正在使用App.xaml并且由于我的不好而将Edit < Undo移动到子目录。

当我尝试启动/调试应用程序时,C#说,我的应用程序没有入口点或静态主方法(CS5001)。

<Application x:Class="SongManager.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Startup="Boot"> </Application> 或默认主文件夹的movint将无效。

怎么了?

修改 在项目设置中,不会侦听任何类/方法: enter image description here

的App.xaml

using System; using System.Windows; using SmuleTools; namespace SongManager { public partial class App : Application { private Account user; public App() { } public Account getAccount() { return this.user; } [STAThread] private void Boot(object sender, StartupEventArgs e) { Login login = new Login(); login.AuthSuccess((Object result) => { this.user = (Account) result; Manager window = new Manager(this); window.Show(); login.Close(); }); login.Show(); } } }

App.xaml.cs

.dropdown.open {
    position: static;
}
.dropdown-menu.image-dropdown-menu {
  left: 25px !important;
  width: 98%;
  top: 180px;
}

2 个答案:

答案 0 :(得分:0)

尝试在Main()课程中添加App方法:

[STAThread]
public static void Main()
{
    App application = new App();
    application.Run();
}

默认情况下,构建应用程序时应该生成一个。

答案 1 :(得分:0)

解决方案有点棘手,但简单

移动主.xaml文件后,构建操作将会丢失 - 项目/编译器设置中的不是

<强>步骤分步:

  1. (红色标记) 点击您的.xaml文件(示例,App.xaml
  2. (蓝色标记) 转到属性窗口(右侧!)
  3. (绿色标记) Other > Build action更改为ApplicationDefinition
  4. <强>截图

    enter image description here

    就是这样!