Getting Started Lesson 2 of 15
Getting Started with C# — Install .NET and Run a Program
Install the .NET SDK, create a console app with dotnet new console, run it with dotnet run, use Visual Studio or VS Code, and read compiler errors.
To write C# programs, you need the .NET SDK (Software Development Kit). It includes the C# compiler and the dotnet command.
Step 1: Install the .NET SDK
- Go to dotnet.microsoft.com and download the latest .NET SDK (the LTS version is a safe choice).
- Run the installer.
- Open a new Command Prompt or Terminal and check:
dotnet --version
Output
8.0.404
Any version 8 or newer is perfect for this course.
Step 2: Create and run a project
dotnet new console -o HelloApp
cd HelloApp
dotnet run
Output
Hello, World!
dotnet new console -o HelloAppcreates a folder with a ready-made console project.- The code is in
Program.cs(C# files end in .cs). dotnet runcompiles and runs it.
Open Program.cs, replace its contents with your own code, save, and dotnet run again:
Console.WriteLine("Hello from C#!");
Console.WriteLine("Grade 11 - ICT");
Output
Hello from C#! Grade 11 - ICT
Using an IDE
- Visual Studio Community (Windows, free): choose the ".NET desktop development" workload. Create a "Console App", then press F5 or the green ▶ button. Great for Windows Forms apps too.
- VS Code: install the "C# Dev Kit" extension. Open your project folder and use the Run button.
- JetBrains Rider: free for non-commercial use.
Reading errors
Console.WriteLine("Hello")
Error
Program.cs(1,27): error CS1002: ; expected
(1,27) means line 1, column 27. CS1002 is the error code, which you can search online. C#'s messages are usually very clear: here, a semicolon is missing.
Errors vs warnings
Errors stop the program from being built. Warnings (yellow) let it build but point out possible problems, like a variable that's never used or a value that might be null. Fix warnings too; they often reveal real bugs.
Running without installing
Online compilers like .NET Fiddle let you run C# in a browser. Choose a recent .NET version. If the site expects a Main method, use the classic structure from Lesson 1.
Comments
// A single-line comment
/* A multi-line
comment */
/// <summary>An XML documentation comment, used above methods and classes.</summary>
Console.WriteLine("Comments are ignored by the compiler.");
Output
Comments are ignored by the compiler.
Quick Quiz
Check what you learned. Walang grade ito, practice lang. 🙂
By Sir Reyel · Last updated 2026-12-04