Home > database >  CS5001 C# Program does not contain a static 'Main' method suitable for an entry point
CS5001 C# Program does not contain a static 'Main' method suitable for an entry point

Time:08-08

hello im trying to make my app work. Windows forms app (.NET Framework) when i started it didnt create a class Program.cs and now it says that error: CS5001 C# Program does not contain a static 'Main' method suitable for an entry point. How do i fix this?

    namespace thingy
    { 

        class Program
        {
        }

    }

CodePudding user response:

Technically, to remove this specific error you need

public static void Main() 
{
 ...
}

but something went wrong in the process of creating the app. I think you should start from scratch.

You could follow Create a Windows Forms app in Visual Studio with C#.

CodePudding user response:

Normally your Program.cs class should look like this:

 public static class Program
 {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    public static void Main()
    {
       // open your form here
       Application.Run(new Form1());
    }
  •  Tags:  
  • c#
  • Related