Skip to main content
C# Fundamentals for Beginners to Advanced
CHAPTER 02 Beginner

Installing Visual Studio and .NET SDK

Updated: May 17, 2026
5 min read

# CHAPTER 2

Installing Visual Studio and .NET SDK

1. Introduction

To write a novel, you need a word processor like Microsoft Word. To write C# code, you need an Integrated Development Environment (IDE). Visual Studio is the industry standard for C# development, providing code completion, debugging, and project management tools all in one package.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Download and install the .NET SDK.
  • Download and install Visual Studio Community Edition.
  • Understand the alternative: VS Code setup.
  • Create your very first C# Console Application.
  • Use basic dotnet CLI commands.

3. Installing the .NET SDK

Before you can run C# code, your computer needs the .NET Software Development Kit (SDK). It contains the compiler and libraries required to build applications.

Steps:

  1. 1. Go to dot.net.
  1. 2. Download the latest .NET SDK (e.g., .NET 8.0) for your operating system.
  1. 3. Run the installer and follow the default prompts.

4. Installing Visual Studio

Visual Studio (VS) is a massive, powerful IDE built by Microsoft specifically for C# and .NET.

Steps:

  1. 1. Go to visualstudio.microsoft.com.
  1. 2. Download Visual Studio Community (it is free for students and individuals).
  1. 3. Run the installer. When the "Workloads" screen appears, check the box for:
  • .NET desktop development (Required for Console apps)
  • ASP.NET and web development (Optional, but good for later chapters)
  1. 4. Click Install.

5. Alternative: VS Code Setup

If you are on a Mac/Linux, or prefer a lightweight editor, you can use Visual Studio Code.
  1. 1. Install VS Code.
  1. 2. Install the C# Dev Kit extension by Microsoft.
  1. 3. Ensure the .NET SDK is installed on your machine.

6. Creating Your First Project

Let's create an app using Visual Studio:
  1. 1. Open Visual Studio.
  1. 2. Click Create a new project.
  1. 3. Search for and select Console App (Make sure the language tag says C#).
  1. 4. Name your project MyFirstApp and click Next.
  1. 5. Choose the latest .NET Framework (e.g., .NET 8.0) and click Create.

Visual Studio will generate a basic "Hello World" template for you. To run it, press the Start button at the top (or press F5 on your keyboard).

7. The dotnet CLI Basics

If you prefer the terminal (Command Prompt/PowerShell), .NET has a powerful Command Line Interface (CLI).

Open your terminal and type:

bash
1234567891011
# Check if .NET is installed
dotnet --version

# Create a new console application in the current folder
dotnet new console -n MyFirstApp

# Navigate into the folder
cd MyFirstApp

# Run the application
dotnet run

8. Output Explanations

When you run your program via Visual Studio or dotnet run, the compiler translates your C# file (Program.cs) into an executable file, runs it, and displays the text output in the black console window.

9. Common Mistakes

  • Confusing Visual Studio with Visual Studio Code: They are completely different products. Visual Studio (purple icon) is the full IDE. VS Code (blue icon) is a lightweight text editor.
  • Skipping the SDK: If you use VS Code and forget to install the .NET SDK, your C# code will not compile or run.
  • Forgetting to save: Always save your files (Ctrl+S) before running the code, otherwise, you'll be running the old version!

10. Best Practices

  • Keep your projects organized in a dedicated folder (e.g., C:\CSharpProjects\).
  • Get comfortable with the terminal (dotnet run). Knowing CLI commands is a sign of a professional developer.

11. Exercises

  1. 1. Install Visual Studio Community and the .NET SDK.
  1. 2. Create a Console App, change "Hello World" to "Hello, [Your Name]!", and run it.
  1. 3. Open a terminal and use dotnet new console to create a second app from the command line.

12. MCQs with Answers

Question 1

Which software is the primary, full-featured IDE for C# development on Windows?

Question 2

What does SDK stand for?

Question 3

Which Visual Studio edition is free for individuals and students?

Question 4

What terminal command creates a new C# console application?

Question 5

What terminal command executes a C# application?

Question 6

What workload must you select in the Visual Studio installer to build console apps?

Q7. Can you write C# code on a Mac? a) Yes, using VS Code or Visual Studio for Mac and the .NET SDK b) No, C# only works on Windows Answer: a) Yes
Question 8

What is the shortcut key to run a program in Visual Studio with debugging?

Question 9

Which file extension is used for C# source code files?

Question 10

What does dotnet --version do?

13. Interview Questions

  • Q: Explain the difference between the .NET SDK and the .NET Runtime.
  • Q: What is the purpose of a .csproj file in a .NET application?

14. FAQs

Q: Do I need a powerful computer to run Visual Studio? A: Visual Studio is a heavy application. If you have an older computer with limited RAM, it is highly recommended to use the lighter Visual Studio Code instead.

15. Summary

To start coding in C#, you need the .NET SDK to compile your code and an IDE like Visual Studio or VS Code to write it. Creating and running projects can be done visually through the IDE or manually using the dotnet CLI.

16. Next Chapter Recommendation

Now that your environment is ready, in Chapter 3: C# Syntax and First Program, we will break down the "Hello World" code line by line to understand how C# syntax works.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·