LinuxCommandLibrary

dotnet

cross-platform .NET development CLI

TLDR

Create new project

$ dotnet new [console] -n [MyApp]
copy
Build project
$ dotnet build
copy
Run project
$ dotnet run
copy
Run tests
$ dotnet test
copy
Add NuGet package
$ dotnet add package [PackageName]
copy
Restore dependencies
$ dotnet restore
copy
Publish for deployment
$ dotnet publish -c Release
copy
List installed SDKs
$ dotnet --list-sdks
copy

SYNOPSIS

dotnet command [options]

DESCRIPTION

dotnet is the .NET CLI for creating, building, running, and publishing .NET applications. It supports C#, F#, and Visual Basic across console apps, web APIs, libraries, and more.
The CLI handles the full development workflow from project creation through deployment. It manages NuGet packages, runs tests, and produces deployment artifacts. Templates provide starting points for various application types.
dotnet works cross-platform on Windows, macOS, and Linux, enabling .NET development everywhere.

PARAMETERS

COMMAND

Operation: new, build, run, test, publish, add, restore, etc.
new TEMPLATE
Create project from template.
build
Build the project.
run
Build and run the project.
test
Run unit tests.
publish
Publish for deployment.
add package NAME
Add NuGet package reference.
restore
Restore NuGet packages.
-c CONFIG
Build configuration (Debug, Release).
--help
Display help information.

CONFIGURATION

global.json

Specifies SDK version and project settings at solution level.
nuget.config
Configures NuGet package sources and credentials.

CAVEATS

Requires .NET SDK installed. Multiple SDK versions can coexist. Large projects may have slow build times. Some features require specific SDK versions.

HISTORY

The dotnet CLI was introduced with .NET Core in 2016 as Microsoft's cross-platform .NET implementation. It unified the fragmented .NET tooling under a single CLI, becoming the standard for .NET development.

SEE ALSO

msbuild(1), nuget(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community