"does not contain a static 'main' method suitable for an entry point"

Solution 1:

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.

Solution 2:

Your project must be created as an empty project. So the output type shows as Console Application. Change it to Class library, and it should work

Solution 3:

simple change in code. main method should be 'Main' (Capital M).

Solution 4:

I just had this issue myself.

I created a winforms project, decided to refactor my code and the project would now not contain the UI, so I deleted the Program.cs and winforms files only to get the same error you were getting.

You either need to re add the static void main() method as Matt Houser mentioned above, or go into the project properties and change the output type in the Application tab to Class Library.

Solution 5:

I have also experienced this wrong. I changed the dropdown situated in Project properties/Application tab (Output type:). The original selected value was "Class Library" but i changed to "Windows Application" and found same error. Now resolved.