none
error on "Main" statement RRS feed

  • Question

  • Trying to learn C#. I downloaded the compiler & typed in the first sample program.

     I get an error on the statement of:

        public static void Main()

    The error reads:

    Error 1 Program 'C:\Users\johni_000\Documents\Visual Studio 2008\Projects\app\app\obj\Release\app.exe' does not contain a static 'Main' method suitable for an entry point app

    Any ideas?  I just copied the one in the beginning of the book.

    Friday, February 22, 2019 10:13 PM

All replies

  • Hi johni,

    Welcome to MSDN forum.

    1.Could you share a simple sample here so that we can check it directly for you.

    2.And since you mentioned this a first sample program, please check the project type and the code structure.

    Try creating a C# Console App(.net framework), and you can find a standard structure of C# code looks like below:

    After that,  F5 to start without debugging or ctrl+F5 to start debuging to see the results of the program.

    This is a simple example for console app. Also you can share info about project type or a screenshot for a simple sample which has this issue here, we will check it directly for you.

    Wish you a happy learning! Look forward to your reply.

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 25, 2019 7:13 AM