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.
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.
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
Visual Studio Code
Visual Studio Code is a lightweight but powerful source code editor that we'll use throughout this course. It's cross-platform and offers excellent support for .NET development.
Important Extensions
- C# Dev Kit: This extension provides a rich C# editing experience and debugging capabilities, among other things.
- NuGet Gallery: Provides a nice UI for exploring NuGet packages. (Much nicer than using the CLI, IMO.)
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)