Tooling Overview
Here's an overview of the key tools you'll encounter in your .NET journey:
Install the dotnet CLI
Visit the official .NET website: https://dot.net
Download and install the .NET SDK for your operating system
Verify the installation by opening a terminal and running:
dotnet --version
You should get the version number of the .NET SDK installed on your system.
MacOS Users: If the
dotnet
command is not found, you may need to create a sym link after running the installer:sudo ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/
Install Visual Studio Code
Visual Studio Code (VS Code) is a lightweight but powerful source code editor that works well with .NET development. Here's how to install it:
- Visit the official Visual Studio Code website: https://code.visualstudio.com/
- Download the installer for your operating system (Windows, macOS, or Linux)
- Run the installer and follow the installation wizard
- Once installed, open VS Code
Install C# Extension for VS Code
To enhance your .NET development experience in VS Code:
- Open VS Code
- Go to the Extensions view by clicking on the square icon in the left sidebar or pressing
Ctrl+Shift+X
(Windows/Linux) orCmd+Shift+X
(macOS) - Search for "C#" in the Extensions marketplace
- Look for the C# Dev Kit extension by Microsoft and click "Install"
This extension provides features like IntelliSense, debugging, and more for C# development in VS Code. NOTE: the extension has licensing requirements for businesses but is free for individuals to use.
I also really like NuGet Gallery - it provides a nice UI for exploring NuGet packages. (Much nicer than using the CLI, IMO.)
Installing Postman
While optional, Postman is a powerful tool for testing APIs. It's what we'll use to test our API in this course (along with Swagger - tbh I just think Postman is cleaner to show on a screen).
- Visit the official Postman website: https://www.postman.com/downloads/
- Download the installer for your operating system (Windows, macOS, or Linux)
- Run the installer and follow the installation wizard
- Once installed, open Postman
Using the dotnet CLI
The .NET Command Line Interface (CLI) is a cross-platform tool for developing, building, running, and publishing .NET applications. Here are some essential commands:
dotnet new
: Creates a new project, configuration file, or solution based on the specified template.dotnet new console -n MyConsoleApp
Common templates include:
console
: Console applicationclasslib
: Class libraryweb
: ASP.NET Core empty web appwebapi
: ASP.NET Core Web APImvc
: ASP.NET Core Web App (Model-View-Controller)blazorserver
: Blazor Server Appblazorwasm
: Blazor WebAssembly Appwpf
: Windows Presentation Foundation (WPF) Applicationwinforms
: Windows Forms Application
To list all available templates:
dotnet new list
To install additional templates:
dotnet new install <TEMPLATE_PACKAGE_NAME>
For example, to install the Microsoft.AspNetCore.SpaTemplates:
dotnet new install Microsoft.AspNetCore.SpaTemplates
dotnet build
: Builds a .NET project and all its dependencies.dotnet build
dotnet publish
: Publishes the application and its dependencies for deployment.dotnet publish -c Release
dotnet run
: Runs source code without any explicit compile or launch commands.dotnet run
dotnet restore
: Restores the dependencies and tools of a project.dotnet restore
dotnet test
: Runs unit tests using the test runner specified in the project.dotnet test
Other IDEs/Tools
While we'll focus on VS Code in this course, it's worth mentioning other popular tools in the .NET ecosystem:
Visual Studio: A full-featured IDE for Windows, offering comprehensive .NET development capabilities.
ReSharper: A powerful extension for Visual Studio that enhances productivity with code inspections, refactorings, and navigation features. Spencer considers it 100% essential for VS development.
JetBrains Rider: A cross-platform .NET IDE developed by JetBrains, known for its performance and advanced features. Spencer considers it the best .NET IDE available (sorry Microsoft)