C# error in replit's IDE

I get this when I run a c# program: CSC : error CS1555: Could not find ‘Program’ specified for Main method [/home/runner/2/sdfsdf.csproj]

The build failed. Fix the build errors and run again.

Hi there @schoolcs! Please could you send the URL of a Repl in which you’re experiencing this problem so we can take a look. :slightly_smiling_face:

Actually, I believe i have managed to find your repl: https://replit.com/@schoolcs/1
The problem is, dotnet is looking for a Program class with a Main function, but you have only provided a class called MainClass. All you need to do to fix your error is rename this class to Program! :+1:

1 Like

Can you please tell me why is it showing error after using “Program” instead of “Main”.

Rename your method from main to Main. Also, you’ll need to change Console.Writeline to Console.WriteLine, and Console.Readline to Console.ReadLine.

Thank you so much , dude.

1 Like