Setup Guide

Goal: Get you writing and running C# code as quickly as possible!


What You'll Need

Hardware Requirements:

Minimum:

  • Windows 10/11, macOS 10.15+, or Linux

  • 4 GB RAM

  • 10 GB free disk space

  • Dual-core processor

Recommended:

  • 8 GB+ RAM

  • 20 GB+ free disk space

  • Quad-core processor

  • SSD (faster compilation)

Good News: C# runs on almost any modern computer!


Best For:

  • Windows users

  • Want full-featured IDE

  • Building large projects

  • Complete beginner experience

Installation Steps:

1. Download Visual Studio 2022 Community Edition

  • Go to: https://visualstudio.microsoft.com/downloads/

  • Click "Free Download" under Community edition

  • It's completely FREE!

  • File size: ~3-5 GB

2. Run the Installer

  • Run the downloaded vs_community.exe

  • The Visual Studio Installer will open

3. Select Workloads On the "Workloads" tab, check:

  • βœ… .NET desktop development (ESSENTIAL)

  • βœ… ASP.NET and web development (recommended)

Click "Install" (bottom right)

4. Wait for Installation

  • Takes 15-30 minutes

  • Good time for coffee! β˜•

5. Launch Visual Studio

  • First launch will ask you to sign in (optional, can skip)

  • Choose theme (Light/Dark/Blue) - purely cosmetic

  • Click "Start Visual Studio"

Create Your First Program

1. Create New Project

  • Click "Create a new project"

  • Search for "Console App"

  • Select "Console App" (C#) - NOT .NET Framework version

  • Click "Next"

2. Configure Project

  • Project name: HelloWorld

  • Location: Choose where to save

  • Click "Next"

3. Additional Information

  • Framework: .NET 8.0 (Long-term support)

  • Click "Create"

4. You Should See:

5. Run the Program

  • Press F5 (or click green "β–Ά Start" button)

  • A console window appears with "Hello, World!"

  • Congratulations! You're a programmer! πŸŽ‰

Visual Studio Keyboard Shortcuts

Action
Shortcut

Run program

F5

Run without debugging

Ctrl + F5

Stop debugging

Shift + F5

Build solution

Ctrl + Shift + B

Save all

Ctrl + Shift + S

Comment/Uncomment

Ctrl + K, Ctrl + C / Ctrl + K, Ctrl + U

Format document

Ctrl + K, Ctrl + D

IntelliSense

Ctrl + Space


Option 2: Visual Studio Code (Cross-Platform)

Best For:

  • macOS or Linux users

  • Lightweight editor preference

  • Already familiar with VS Code

  • Want flexibility

Installation Steps:

1. Install .NET 8 SDK

  • Go to: https://dotnet.microsoft.com/download

  • Download .NET 8.0 SDK

  • Run installer

  • Verify installation:

    Should show: 8.0.x

2. Install Visual Studio Code

  • Go to: https://code.visualstudio.com/

  • Download for your OS

  • Install

3. Install C# Extension

  • Open VS Code

  • Click Extensions icon (left sidebar) or press Ctrl+Shift+X

  • Search: "C# Dev Kit"

  • Click "Install" on "C# Dev Kit" by Microsoft

  • Wait for installation

4. Restart VS Code

Create Your First Program

1. Open Terminal in VS Code

  • Press Ctrl + ` (backtick)

  • Or: View β†’ Terminal

2. Create New Console Project

3. Open the Project

(Or: File β†’ Open Folder β†’ select HelloWorld)

4. You Should See:

5. Run the Program

  • Press F5

  • Or in terminal:

  • Output: Hello, World!

  • You're coding! πŸŽ‰

VS Code Keyboard Shortcuts

Action
Shortcut

Run program

F5 (after setting up launch.json)

Open terminal

Ctrl + `

Command palette

Ctrl + Shift + P

Save

Ctrl + S

Format document

Shift + Alt + F

Comment/Uncomment

Ctrl + /

IntelliSense

Ctrl + Space


Option 3: Online (No Installation)

Best For:

  • Quick testing

  • Can't install software

  • Trying C# before committing

  • Shared computers

1. .NET Fiddle (Best)

  • URL: https://dotnetfiddle.net/

  • No sign-up required

  • Supports C# console apps

  • Can save and share code

2. Replit

  • URL: https://replit.com/

  • Sign up required (free)

  • Full project support

  • Collaboration features

3. OneCompiler

  • URL: https://onecompiler.com/csharp

  • Simple interface

  • Quick testing

  • No account needed

Limitations:

  • No debugging tools

  • Limited project complexity

  • Internet required

  • Not suitable for capstone projects

Recommendation: Use online IDEs for early chapters, then install proper IDE.


Understanding Your Development Environment

What Just Happened?

When you created your first program, several things were set up:

1. Project File (.csproj)

  • Defines project type (Console Application)

  • Specifies .NET version (8.0)

  • Build configuration

2. Program.cs

  • Your actual code

  • Entry point of application

  • Top-level statements (C# 10+ feature)

3. bin/ folder (appears after building)

  • Contains compiled executable

  • Debug vs Release builds

4. obj/ folder

  • Temporary build files

  • Can be safely deleted


Essential Concepts

What is .NET?

.NET is a free, open-source development platform:

  • Build console apps, web apps, mobile apps, games

  • Write once, run anywhere (Windows, Mac, Linux)

  • Includes libraries for common tasks

  • Managed by Microsoft

Versions:

  • .NET Framework (old, Windows-only) ❌

  • .NET Core (newer, cross-platform) βœ…

  • .NET 5, 6, 7, 8+ (modern, unified) βœ…

We use .NET 8 (latest LTS - Long Term Support)

What is C#?

C# (pronounced "C Sharp") is:

  • Programming language

  • Type-safe and object-oriented

  • Designed by Microsoft

  • Used for Windows apps, web services, games (Unity), and more

Current version: C# 12 (comes with .NET 8)

Compilation Process:

Key Point: C# is compiled, not interpreted. This makes it fast!


Your First Real Program

Let's modify Hello World to understand the basics:

Try running this!

What's Happening:

  1. Console.WriteLine() - Outputs text and moves to new line

  2. Console.Write() - Outputs text without new line

  3. Console.ReadLine() - Reads user input

  4. string name - Creates a variable to store text

  5. $"..." - String interpolation (embed variables)

  6. Console.ReadKey() - Waits for key press


Common Setup Issues

Issue: "dotnet command not found"

Solution:

  • Restart terminal/computer after installing .NET SDK

  • Check installation: dotnet --version

  • Re-download and install .NET SDK

Issue: "No framework found"

Solution:

  • Install .NET SDK (not just Runtime)

  • Check SDK: dotnet --list-sdks

  • Framework version mismatch - update .csproj

Issue: VS Code C# extension not working

Solution:

  • Install "C# Dev Kit" (not just "C#")

  • Restart VS Code

  • Open a .cs file to activate extension

  • Check output panel for errors

Issue: Program closes immediately

Solution: Add at the end of your code:

Or run with Ctrl+F5 (without debugging) in Visual Studio.

Issue: Can't find Visual Studio 2022 option

Solution:

  • Make sure you downloaded "Community" edition (free)

  • Not "Code" (different product)

  • Not "Express" (discontinued)


Configuring Your Environment

Visual Studio Recommendations:

1. Enable Line Numbers

  • Tools β†’ Options

  • Text Editor β†’ All Languages β†’ General

  • Check "Line numbers"

2. Change Theme

  • Tools β†’ Options

  • Environment β†’ General

  • Color theme: Blue/Dark/Light

3. Font Size

  • Tools β†’ Options

  • Environment β†’ Fonts and Colors

  • Size: 12-14 recommended

4. Auto-Save

  • Tools β†’ Options

  • Environment β†’ Documents

  • Check "Save documents as..."

VS Code Recommendations:

1. Settings Sync

  • Sign in with Microsoft/GitHub

  • Sync settings across devices

2. Useful Extensions

  • "C# Dev Kit" (essential)

  • "Error Lens" (inline errors)

  • "Prettier" (formatting)

  • "GitLens" (if using Git)

3. Settings (File β†’ Preferences β†’ Settings):

  • Auto Save: onFocusChange

  • Format On Save: true

  • Font Size: 14


Testing Your Setup

Verification Program:

Create a new console app and run this:

If this runs successfully, you're ready to start learning!


Project Organization Tips

Folder Structure:

Tips:

  • One folder per phase

  • One project per problem

  • Use descriptive names

  • Keep it organized from day one!


Why Use Git?

  • Track your progress

  • Experiment without fear

  • Build portfolio on GitHub

  • Industry standard

Basic Git Setup:

1. Install Git

  • Windows: https://git-scm.com/download/win

  • Mac: brew install git or download

  • Linux: sudo apt install git

2. Configure Git

3. For Each Project:

4. Push to GitHub (optional):

  • Create repository on GitHub

  • Follow their instructions to push

Don't worry about Git now - you can add it later!


Productivity Tools (Optional)

1. LINQPad (Windows)

  • Quick C# testing

  • LINQ visualization

  • Free version available

  • https://www.linqpad.net/

2. Snippet Manager

  • Save code snippets

  • Built into Visual Studio

  • Tools β†’ Code Snippets Manager

3. ReSharper (Advanced)

  • Visual Studio extension

  • Code analysis and refactoring

  • Paid (student licenses available)

  • NOT needed for this book


What's Next?

You're Ready When:

βœ… Visual Studio or VS Code installed βœ… .NET 8 SDK installed βœ… Created and ran "Hello World" βœ… Understand basic IDE navigation βœ… Can create new console projects

Now You Can:

  1. Start Phase 1, Problem 1 (Simple Calculator)

  2. Create a dedicated learning folder

  3. Set aside daily practice time

  4. Join the learning community


Quick Reference Card

Creating New Project:

Visual Studio:

  1. File β†’ New β†’ Project

  2. Console App (C#)

  3. Name it, create it, start coding!

VS Code / Terminal:

Running Your Code:

Visual Studio:

  • Press F5 (with debugging)

  • Press Ctrl+F5 (without debugging)

VS Code / Terminal:

Common Commands:


Troubleshooting Checklist

Program won't run?

Can't see output?

IntelliSense not working?

Still stuck?

  • Search error message on Google

  • Check Stack Overflow

  • Ask in community forums

  • Re-read this chapter


You're Ready! πŸš€

Setup Complete! βœ…

You now have:

  • βœ… Development environment installed

  • βœ… First program running

  • βœ… Understanding of basic workflow

  • βœ… Troubleshooting knowledge

Time to start coding!

Next Chapter: Phase 1 - Fundamentals

Let's build that Simple Calculator! πŸ’»βœ¨

Last updated