Search code examples
c#wpfxamlsharpdevelopentry-point

WPF has no entry point


I'm using SharpDevelop and had by my bad moved the App.xaml to an Subdirectory.

When i try to start/debug the Application, C# says, that my Application has no entry points or a static main method (CS5001).

An Edit < Undo or an movint to the default main folder will be not working.

Whats wrong?

Edit On Project-Settings, no Classes/Methods are listened: enter image description here

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();
        }
    }
}

Solution

  • The Solution is a little bit tricky, but easy.

    After moving the main .xaml file, the Build action will be lost - These are not in the Project/Compiler settings!

    Step-by-Step:

    1. (red mark) Click on your .xaml file (for sample, App.xaml)
    2. (blue mark) Go to the Properties window (on the right side!)
    3. (green mark) Change Other > Build action to ApplicationDefinition

    Screenshot

    enter image description here

    That is it!