Back

Setting Up Your Workspace

divider

What You Need

You need three things. All of them are free.

  1. Visual Studio Code— the editor where you write and run your programs.
  2. The .NET 10 SDK— the software that compiles and runs C#.
  3. The course workspace — the templates, settings, and offline packages used by every activity.
Install the SDK, not only the runtime. The runtime can run a finished program. The SDK is what lets you build your own.
divider

Get the Workspace

  1. Download csharp-workspace.zip
  2. Extract the ZIP. Do not work from inside the compressed file.
  3. Move the extracted csharp-workspace folder somewhere you can find again.
  4. In VS Code, choose File > Open Folder and open thefolder, not one file inside it.

VS Code will recommend three extensions. Choose Install orInstall All. They provide the play button, C# error checking, autocomplete, and clearer file icons.

The workspace includes hidden setup files that keep every classroom computer on the same toolchain. You only need to work inside your activity folders.
divider

Run the Console Template

  1. In the Explorer panel, open template-console/Program.cs.
  2. Find the triangle at the top right of the editor. Its tooltip saysRun Code.
  3. Press it. The terminal panel opens at the bottom.
  4. Click inside the terminal, type your name, and press Enter.
Console Template
Console.Write("What is your name? ");
string name = Console.ReadLine();
Console.WriteLine($"Nice to meet you, {name}!");
Example Output
What is your name? Ada [Enter]
Nice to meet you, Ada!

The program waits because Console.ReadLine() asks for input. A waiting program is not frozen.

divider

Two Templates

The course uses two program shapes. Copy the one named by the activity; they are not interchangeable.

Console programs

A console program runs from top to bottom and then ends. Use it when text, input, arithmetic, or tracing is the point.

Raylib programs

A Raylib program opens a second window and repeats a game loop until you close it. Use it for drawing, motion, interaction, and simulation.

Game Template
using Raylib_cs;
int screenWidth = 800;
int screenHeight = 600;
Raylib.InitWindow(screenWidth, screenHeight, "Hello, Raylib!");
Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose())
{
Raylib.BeginDrawing();
Raylib.ClearBackground(Color.Black);
Raylib.DrawText("Hello, World!", 320, 285, 24, Color.SkyBlue);
Raylib.EndDrawing();
}
Raylib.CloseWindow();
  1. Open template-game/Program.cs.
  2. Press the triangular Run Code play button.
  3. Confirm that a window opens and displays blue text.
  4. Press Escape or close the window.

The game template carries its Raylib settings when you copy the folder. Raylib is already inside the workspace; there is nothing else to install.

divider

Where Your Work Goes

Never edit a template directly. For every activity, copy its folder and rename the copy. Activity 1.1 will begin like this:

  1. Right-click template-console.
  2. Choose Copy, then paste it inside the workspace.
  3. Rename the copy 1-01-hello.
  4. Edit only the new folder's Program.cs.

A clean template gives every new activity the same known-good starting point. If one activity breaks, the next one still starts correctly.

divider

Read the First Error

C# usually tells you the file, line, error code, and problem. For example, a missing closing quote can produce:

Compiler Output
Program.cs(1,19): error CS1010: Newline in constant

Read it from left to right:

  • Program.cs is the file.
  • (1,19) is line 1, character 19.
  • CS1010 is a searchable error code.
  • Newline in constant describes what the compiler found.

The named line is where C# became unable to continue. Start there, then look one line above it too. Fix one thing and run again.

divider

If Something Goes Wrong

There is no play button

Open Extensions, type @recommended, and install the recommended extensions. Then reopen VS Code.

The terminal says no SDK was found

Install the .NET 10 SDK, then close and reopen VS Code. The runtime by itself is not enough.

The program will not stop

Click the trash-can button in the terminal panel. Its tooltip saysKill Terminal.

The game window opens and closes immediately

Read the terminal. The window disappeared because the program stopped, and the error underneath usually explains why.

divider

Setup Check

You are ready when all four statements are true:

  • The workspace is extracted and open as a folder in VS Code.
  • The recommended extensions are installed.
  • The console template asks for your name.
  • The game template opens a Raylib window and closes normally.

Workspace Ready