I have the following code :
namespace WpfApplication2 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MyWindow : Window { public MyWindow() { Width = 300; Height = 200; Title = "My Program Window"; Content = "This application handles the Startup event."; } } class Program { static void App_Startup(object sender, StartupEventArgs args) { MessageBox.Show("The application is starting", "Starting Message"); } [STAThread] static void Main() { MyWindow win = new MyWindow(); Application app = new Application(); app.Startup += App_Startup; app.Run(win); } } } When I run this code, I get the following error:
Error 1 Program 'c:...\WpfApplication2\WpfApplication2\obj\Debug\WpfApplication2.exe' has more than one entry point defined: 'WpfApplication2.Program.Main()'. Compile with /main to specify the type that contains the entry point.
There is no "Program"file on my code as far as I see. I don't know how to fix this. Can you tell me how to fix? Thanks.