Development Tools
Setting up .NET means installing the tools you need to build applications. In this topic, we will learn about the three main tools used for C# development: the .NET CLI, Visual Studio, and Visual Studio Code.
The .NET SDK & CLI (The Core Engine)
Think of the .NET SDK as the engine under the hood. You must install this first. It includes the .NET CLI, which lets you control your projects using text commands.
The .NET SDK provides the tools required to create, build, test, and run .NET applications.
How to Install
Go to the official .NET website, download the installer for your computer (Windows, Mac, or Linux), and run it.
How to Check It
Open your computer's terminal such as Command Prompt, PowerShell, or Terminal and type:
dotnet --version
If a version number appears, the .NET SDK is installed correctly and the command is working.
Useful .NET CLI Commands
| Command | Purpose |
|---|---|
dotnet --version
|
Displays the installed .NET SDK version. |
dotnet new console -n MyApp
|
Creates a new console application folder named MyApp. |
dotnet run
|
Builds and runs the current .NET application. |
dotnet build
|
Builds the application and checks the project for compilation errors. |
Verify Your .NET Installation
After installing the .NET SDK, it is a good practice to verify that the SDK is correctly installed and available from the terminal.
Open Command Prompt or PowerShell and run the following commands one by one:
dotnet --version
dotnet --info
dotnet --list-sdks
What These Commands Show
| Command | What It Shows |
|---|---|
dotnet --version
|
Shows the currently selected .NET SDK version. |
dotnet --info
|
Shows detailed information about the installed .NET environment. |
dotnet --list-sdks
|
Shows all .NET SDK versions installed on the computer. |
Visual Studio (The Full Power Tool for Windows)
Visual Studio is a massive, all-in-one software box. It has everything built-in, but it is heavy and primarily used on Windows.
Visual Studio provides many features such as code editing, debugging, project management, testing, NuGet package management, Git integration, and tools for building ASP.NET and .NET applications.
How to Install
Download the Visual Studio Installer from Microsoft's website and start the installation process.
Important Step
During installation, it will ask you to choose Workloads (packages of features). Select the workloads required for the type of application you want to develop.
Recommended Workloads for C# Development
- ASP.NET and web development
- .NET desktop development
Best For
Visual Studio is suitable for large business applications and developers who prefer an all-in-one development environment where most tools are already available.
Visual Studio Code (The Lightweight Editor)
Visual Studio Code (VS Code) is a very fast, lightweight text editor. It works on Windows, Mac, and Linux.
It starts simple, but you can add extensions (plugins) to make it powerful for different programming languages and development platforms.
How to Install
Download Visual Studio Code from the VS Code website and install it on your computer.
Make VS Code Work with .NET
- Open Visual Studio Code.
- Click the Extensions icon on the left menu. It looks like four small squares.
- Search for and install the C# Dev Kit.
- The C# Dev Kit provides support for working with C# and .NET projects inside VS Code.
Create a New .NET Project
Open an empty folder in VS Code. Press Ctrl + Shift + P (or Cmd + Shift + P on Mac) to open the Command Palette.
Then search for:
.NET: New Project
Choose the project type you want to create and follow the instructions provided by VS Code.
Create Your First .NET Project Using CLI
The .NET CLI allows you to create and manage projects directly from the terminal. This is especially useful because developers can create projects without opening an IDE.
Open Command Prompt or PowerShell and run:
dotnet new console -n MyFirstApp
This command creates a new console application named MyFirstApp.
Step 2: Open the Project Folder
cd MyFirstApp
Step 3: Run the Application
dotnet run
Expected Output
WelCome to CIIT World ππ¨βπ«...!
Which Tool Should You Use?
Visual Studio
Use Visual Studio if you are on Windows and want an all-in-one tool where everything is already set up.
Visual Studio Code
Use VS Code if you want a fast, lightweight tool, or if you are using a Mac or Linux computer.
Visual Studio vs VS Code
| Feature | Visual Studio | VS Code |
|---|---|---|
| Type | Full IDE | Lightweight Code Editor |
| Platform | Primarily Windows | Windows, macOS, Linux |
| Installation Size | Larger | Smaller |
| Extensions | Many features are built-in | Extensions are commonly used |
| Best For | Large and enterprise applications | Lightweight and flexible development |
Basic C# Development Workflow
A simple C# development workflow can be understood as:
Install .NET SDK
β
Choose Visual Studio / VS Code
β
Create a .NET Project
β
Write C# Code
β
Build the Project
β
Run the Application
β
Debug and Fix Errors
Understanding this workflow will make it easier to work with C# projects throughout the rest of the course.
Common Problems & Quick Fixes
Beginners may face some common setup problems while starting C# development. The following table provides quick solutions.
| Problem | Possible Solution |
|---|---|
dotnet command is not recognized
|
Check whether the .NET SDK is installed correctly and restart the terminal. |
| C# code is not recognized in VS Code | Make sure the C# Dev Kit extension is installed and enabled. |
| Project build fails | Read the error message in the terminal or Error List and fix the reported issue. |
| Wrong .NET SDK version |
Run dotnet --version and
dotnet --list-sdks to check
installed SDK versions.
|
| Changes are not reflected | Save the file and rebuild or run the application again. |
Simple C# Code Example
Once the development environment is ready, you can create and run a simple C# program.
using System;
class Program
{
static void Main()
{
Console.WriteLine("WelCome CIIT Instituteπ€");
}
}
Summary
Development tools provide everything required to
create, build, run, and debug C# applications.
The .NET SDK provides the core
development tools and the .NET CLI
allows developers to manage projects using commands.
Visual Studio provides a complete
development environment, while
Visual Studio Code provides a
lightweight and flexible development experience.
You also learned how to verify your .NET installation,
create a console project using the .NET CLI, run a
project, compare Visual Studio with VS Code, and
troubleshoot common setup problems.
Understanding these tools is an important first step
before learning C# programming in depth.