“does not contain a static ‘main’ method suitable for an entry point”

Every C# program needs an entry point. By default, a new c# Windows Forms project includes a Program class in a Program.cs file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StackOverflow6
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

You are probably missing this or deleted it.

Leave a Comment