Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Console I/O Start Coding

olu adesina
olu adesina
23,007 Points

keep getting an error c#

class Program
{
    static void Main()
    {
        // Prompt user for minutes exercised 
        System.Console.Write("Enter how many minutes you exercised: ");

        // Add minutes exercised to total 
        // Display total minutes exercised to the screen 
        // Repeat until user quits    
    }
}

keep getting this error in console treehouse:~/workspace$ mcs program.cs
error CS2001: Source file `program.cs' could not be found
Compilation failed: 1 error(s), 0 warnings

i deleted an old workspace as i wanted to start again is that the problem

4 Answers

Wade Williams
Wade Williams
24,476 Points

Capitalization matters when compiling, the file is Program.cs not program.cs. Capitalizing Program should solve your problem.

mcs Program.cs

Robert Patterson
Robert Patterson
2,915 Points

Happened to me too, the one thing not mentioned in the directions is you need to make sure that you are in the FitnessFrog directory, your command prompt should look like this :

treehouse:~/workspace/FitnessFrog$

if you just have this for a command prompt:

treehouse:~/workspace$

then you need to go to that directory by entering:

treehouse:~/workspace$cd FitnessFrog

Sean Gibson
Sean Gibson
38,363 Points

I can't even do this. It tells me no such directory exists...

Follow-up: It seems that this may have been because in the video the FOLDER is named "FitnessFrog", whereas my workspace is named "C# Basics - Start Coding" by default. At this stage (it's my first day on Treehouse) I don't know how to change the folder name, or even if it's necessary. The program was able to compile in the end without changing the directory. My problem, it turns out, was that I hadn't saved the project.

I had the same problem, thank you for this thread! The console was returning an error message which said error CS5001 ' Program.exe does not contain a static 'Main' method suitable for an entry point'. I pressed 'save' within the file menu, and all was solved.