dotnet
Run, build, and manage .NET applications
TLDR
Initialize a new .NET project
Restore NuGet packages
Build and execute the .NET project in the current directory
Run a packaged dotnet application (only needs the runtime, the rest of the commands require the .NET Core SDK installed)
SYNOPSIS
dotnet [command] [options]
PARAMETERS
new
Initializes a new .NET project.
build
Builds a .NET project.
run
Runs a .NET application.
test
Runs unit tests in a .NET project.
publish
Publishes a .NET application for deployment.
add
Adds a package reference or tool reference to a project.
remove
Removes a package reference or tool reference from a project.
restore
Restores dependencies specified in the project file.
nuget
Provides commands for working with NuGet packages.
sdk-info
Displays information about the installed .NET SDKs.
tool
Installs, uninstalls, updates and runs tools.
--info
Displays .NET information.
--version
Displays the version of the .NET CLI.
DESCRIPTION
The .NET command-line interface (CLI) is a cross-platform toolchain for developing, building, running, and publishing .NET applications. It provides a common entry point for .NET development tasks, abstracting away complexities of the underlying platform and SDK.
The dotnet command serves as the driver for various .NET operations, including creating new projects, restoring dependencies, building applications, running tests, publishing deployments, and managing .NET SDK versions. It uses subcommands to execute a range of tasks.
It is an essential component of the .NET development workflow, enabling developers to easily manage their projects from the command line. The tool is designed for both interactive use and integration into automated build processes.
CAVEATS
Requires the .NET SDK to be installed on the system. The available commands and options may vary depending on the installed SDK version and project type.
TEMPLATES
The dotnet new command uses templates to generate different types of .NET projects, such as console applications, web APIs, class libraries, and more. You can list available templates using dotnet new list and install new templates using dotnet new install.
GLOBAL TOOLS
.NET global tools are console applications that are installed from NuGet packages and can be invoked from any directory on the system. They provide a way to extend the functionality of the .NET CLI.
HISTORY
The dotnet CLI was introduced with .NET Core 1.0 as part of the effort to create a cross-platform, open-source .NET runtime. It has evolved through subsequent .NET releases (.NET Core 2.x, .NET Core 3.x, .NET 5, .NET 6, .NET 7, .NET 8, etc.) with significant improvements in performance, features, and usability. It is now a core component of modern .NET development.
SEE ALSO
msbuild(1), nuget(1)