我正在使用 SharpDevelop
并且通过我的错误将 App.xaml
移动到子目录 .
当我尝试启动/调试应用程序时,C#说,我的应用程序没有入口点或静态主方法(CS5001) .
Edit < Undo
或默认主文件夹的movint将无法使用 .
怎么了?
Edit 在项目设置中,不会侦听任何类/方法:
App.xaml
<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>
App.xaml.cs
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();
}
}
}
2 回答
尝试在
App
类中添加Main()
方法:默认情况下,构建应用程序时应生成一个 .
解决方案有点棘手,但 easy .
移动主
.xaml
文件后, Build action 将丢失 - 这些是项目/编译器设置中的 not !Step-by-Step:
(red mark) 单击
.xaml
文件(示例,App.xaml
)(blue mark) 转到 Properties 窗口(右侧!)
(green mark) 将
Other > Build action
更改为ApplicationDefinition
Screenshot
这就对了!