07 Sep 2010

Program does not contain a static 'Main' method suitable for an entry point

I usually create projects in Visual Studio using the Empty project template, even if they are going to be a WPF application. As the code evolves I keep adding the appropriate references (System.Xaml, PresentationCore and so on).

At some point I’m ready to launch the application and I receive the mentioned error:

Program XXXX does not contain a static ‘Main’ method suitable for an entry point.

Invariably I keep forgetting where the problem is. So I start inspecting the project properties, the App class, etc. After some minutes, frustrated, I launch Google and I find the answer. It has happened way too many times, so I’m writing it here. Now I’m sure I will never forget it.

The file App.xaml is set to some other thing instead of ApplicationDefinition!!

XAML