dotnet command(1)

dotnet command

NAME

dotnet - A tool for managing .NET source code and binaries.

SYNOPSIS

  .NET Core 2.1

    dotnet [command] [arguments] [--additional-deps] [--additionalprobingpath] [--depsfile]
        [-d|--diagnostics] [--fx-version] [-h|--help] [--info] [--list-runtimes] [--list-sdks] [--roll-forward-on-no-candidate-fx] [--runtimeconfig] [-v|--verbosity] [--version]

  .NET Core 2.0

    dotnet [command] [arguments] [--additional-deps] [--additionalprobingpath] [--depsfile]
        [-d|--diagnostics] [--fx-version] [-h|--help] [--info] [--roll-forward-on-no-candidate-fx]
        [--runtimeconfig] [-v|--verbosity] [--version]

  .NET Core 1.x

    dotnet [command] [arguments] [--additionalprobingpath] [--depsfile] [-d|--diagnostics]
        [--fx-version] [-h|--help] [--info] [--runtimeconfig] [-v|--verbosity] [--version]

   * * * * *

DESCRIPTION

dotnet is a tool for managing .NET source code and binaries. It exposes commands that perform specific tasks, such as dotnet build and dotnet run. Each command defines its own arguments. Type --help after each command to access brief help documentation.

dotnet can be used to run applications, by specifying an application DLL, such as dotnet myapp.dll. See .NET Core application deployment for to learn about deployment options.

OPTIONS

  .NET Core 2.1

--additional-deps <PATH>

Path to an additional .deps.json file.

--additionalprobingpath <PATH>

Path containing probing policy and assemblies to probe.

--depsfile

Path to a deps.json file.

A deps.json file contains a list of dependencies, compilation dependencies and version information used to address assembly conflicts. For more information about this file, see Runtime Configuration Files on GitHub.

-d|--diagnostics

Enables diagnostic output.

--fx-version <VERSION>

Version of the .NET Core runtime to use to run the application.

-h|--help

Prints out documentation for a given command, such as dotnet build --help. dotnet --help prints a list of available commands.

--info

Prints out detailed information about a .NET Core installation and the machine environment, such as the current operating system, and commit SHA of the .NET Core version.

--list-runtimes

Displays the installed .NET Core runtimes.

--list-sdks

Displays the installed .NET Core SDKs.

--roll-forward-on-no-candidate-fx <N>

Defines behavior when the required shared framework is not available. N can be:

•   0 - Disable even minor version roll forward.

•   1 - Roll forward on minor version, but not on major version. This is the default behavior.

•   2 - Roll forward on minor and major versions.

For more information, see Roll forward.

--runtimeconfig

Path to a runtimeconfig.json file.

A runtimeconfig.json file is a configuration file containing runtime configuration settings. For more information, see Runtime Configuration Files on GitHub.

-v|--verbosity <LEVEL>

Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. Not supported in every command; see specific command page to determine if this option is available.

--version

Prints out the version of the .NET Core SDK in use.

  .NET Core 2.0

--additional-deps <PATH>

Path to an additional .deps.json file.

--additionalprobingpath <PATH>

Path containing probing policy and assemblies to probe.

--depsfile

Path to a deps.json file.

A deps.json file contains a list of dependencies, compilation dependencies and version information used to address assembly conflicts. For more details on this file, see Runtime Configuration Files on GitHub.

-d|--diagnostics

Enables diagnostic output.

--fx-version <VERSION>

Version of the .NET Core runtime to use to run the application.

-h|--help

Prints out documentation for a given command, such as dotnet build --help. dotnet --help prints a list of available commands.

--info

Prints out detailed information about a .NET Core installation and the machine environment, such as the current operating system, and commit SHA of the .NET Core version.

--roll-forward-on-no-candidate-fx

Disables minor version roll forward, if set to 0. For more information, see Roll forward.

--runtimeconfig

Path to a runtimeconfig.json file.

A runtimeconfig.json file is a configuration file containing runtime configuration settings. For more details, see Runtime Configuration Files on GitHub.

-v|--verbosity <LEVEL>

Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. Not supported in every command; see specific command page to determine if this option is available.

--version

Prints out the version of the .NET Core SDK in use.

  .NET Core 1.x

--additionalprobingpath <PATH>

Path containing probing policy and assemblies to probe.

--depsfile

Path to a deps.json file.

A deps.json file contains a list of dependencies, compilation dependencies and version information used to address assembly conflicts. For more details on this file, see Runtime Configuration Files on GitHub.

-d|--diagnostics

Enables diagnostic output.

--fx-version <VERSION>

Version of the .NET Core runtime to use to run the application.

-h|--help

Prints out documentation for a given command, such as dotnet build --help. dotnet --help prints a list of available commands.

--info

Prints out detailed information about a .NET Core installation and the machine environment, such as the current operating system, and commit SHA of the .NET Core version.

--runtimeconfig

Path to a runtimeconfig.json file.

A runtimeconfig.json file is a configuration file containing runtime configuration settings. For more details, see Runtime Configuration Files on GitHub.

-v|--verbosity <LEVEL>

Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. Not supported in every command; see specific command page to determine if this option is available.

--version

Prints out the version of the .NET Core SDK in use.

   * * * * *

  dotnet commands

  General

  .NET Core 2.1

Command | Function
dotnet build | Builds a .NET Core application.
dotnet build-server | Interacts with servers started by a build.
dotnet clean | Clean build outputs.
dotnet help | Shows more detailed documentation online for the command.
dotnet migrate | Migrates a valid Preview 2 project to a .NET Core SDK 1.0 project.
dotnet msbuild | Provides access to the MSBuild command line.
dotnet new | Initializes a C# or F# project for a given template.
dotnet pack | Creates a NuGet package of your code.
dotnet publish | Publishes a .NET framework-dependent or self-contained application.
dotnet restore | Restores the dependencies for a given application.
dotnet run | Runs the application from source.
dotnet sln | Options to add, remove, and list projects in a solution file.
dotnet store | Stores assemblies in the runtime package store.
dotnet test | Runs tests using a test runner.

  .NET Core 2.0

Command | Function
dotnet build | Builds a .NET Core application.
dotnet clean | Clean build outputs.
dotnet help | Shows more detailed documentation online for the command.
dotnet migrate | Migrates a valid Preview 2 project to a .NET Core SDK 1.0 project.
dotnet msbuild | Provides access to the MSBuild command line.
dotnet new | Initializes a C# or F# project for a given template.
dotnet pack | Creates a NuGet package of your code.
dotnet publish | Publishes a .NET framework-dependent or self-contained application.
dotnet restore | Restores the dependencies for a given application.
dotnet run | Runs the application from source.
dotnet sln | Options to add, remove, and list projects in a solution file.
dotnet store | Stores assemblies in the runtime package store.
dotnet test | Runs tests using a test runner.

  .NET Core 1.x

Command | Function
dotnet build | Builds a .NET Core application.
dotnet clean | Clean build outputs.
dotnet migrate | Migrates a valid Preview 2 project to a .NET Core SDK 1.0 project.
dotnet msbuild | Provides access to the MSBuild command line.
dotnet new | Initializes a C# or F# project for a given template.
dotnet pack | Creates a NuGet package of your code.
dotnet publish | Publishes a .NET framework-dependent or self-contained application.
dotnet restore | Restores the dependencies for a given application.
dotnet run | Runs the application from source.
dotnet sln | Options to add, remove, and list projects in a solution file.
dotnet test | Runs tests using a test runner.

   * * * * *

  Project references

Command | Function
dotnet add reference | Adds a project reference.
dotnet list reference | Lists project references.
dotnet remove reference | Removes a project reference.

  NuGet packages

Command | Function
dotnet add package | Adds a NuGet package.
dotnet remove package | Removes a NuGet package.

  NuGet commands

Command | Function
dotnet nuget delete | Deletes or unlists a package from the server.
dotnet nuget locals | Clears or lists local NuGet resources such as http-request cache, temporary cache, or machine-wide global packages folder.
dotnet nuget push | Pushes a package to the server and publishes it.

  Global Tools commands

.NET Core Global Tools are available starting with .NET Core SDK 2.1.300:

Command | Function
dotnet tool install | Installs a Global Tool on your machine.
dotnet tool list | Lists all Global Tools currently installed in the default directory on your machine or in the specified path.
dotnet tool uninstall | Uninstalls a Global Tool from your machine.
dotnet tool update | Updates a Global Tool on your machine.

  Additional tools

Starting with .NET Core SDK 2.1.300, a number of tools that were available only on a per project basis using DotnetCliToolReference are now available as part of the .NET Core SDK. These tools are listed in the following table:

Tool | Function
dev-certs | Creates and manages development certificates.
ef | Entity Framework Core command-line tools.
sql-cache | SQL Server cache command-line tools.
user-secrets | Manages development user secrets.
watch | Starts a file watcher that runs a command when files change.

For more information about each tool, type dotnet <tool-name> --help.

EXAMPLES

Creates a new .NET Core console application:

dotnet new console

Restore dependencies for a given application:

dotnet restore

Build a project and its dependencies in a given directory:

dotnet build

Run an application DLL, such as myapp.dll:

dotnet myapp.dll

ENVIRONMENT VARIABLES

  .NET Core 2.1

DOTNET_PACKAGES

The global packages folder. If not set, it defaults to ~/.nuget/packages on Unix or %userprofile%\.nuget\packages on Windows.

DOTNET_SERVICING

Specifies the location of the servicing index to use by the shared host when loading the runtime.

DOTNET_CLI_TELEMETRY_OPTOUT

Specifies whether data about the .NET Core tools usage is collected and sent to Microsoft. Set to true to opt-out of the telemetry feature (values true, 1, or yes accepted). Otherwise, set to false to opt into the telemetry features (values false, 0, or no accepted). If not set, the default is false and the telemetry feature is active.

DOTNET_MULTILEVEL_LOOKUP

Specifies whether .NET Core runtime, shared framework, or SDK are resolved from the global location. If not set, it defaults to true. Set to false to not resolve from the global location and have isolated .NET Core installations (values 0 or false are accepted). For more information about multi-level lookup, see Multi-level SharedFX Lookup.

DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX

Disables minor version roll forward, if set to 0. For more information, see Roll forward.

  .NET Core 2.0

DOTNET_PACKAGES

The primary package cache. If not set, it defaults to $HOME/.nuget/packages on Unix or %userprofile%\.nuget\packages on Windows.

DOTNET_SERVICING

Specifies the location of the servicing index to use by the shared host when loading the runtime.

DOTNET_CLI_TELEMETRY_OPTOUT

Specifies whether data about the .NET Core tools usage is collected and sent to Microsoft. Set to true to opt-out of the telemetry feature (values true, 1, or yes accepted). Otherwise, set to false to opt into the telemetry features (values false, 0, or no accepted). If not set, the default is false and the telemetry feature is active.

DOTNET_MULTILEVEL_LOOKUP

Specifies whether .NET Core runtime, shared framework, or SDK are resolved from the global location. If not set, it defaults to true. Set to false to not resolve from the global location and have isolated .NET Core installations (values 0 or false are accepted). For more information about multi-level lookup, see Multi-level SharedFX Lookup.

  .NET Core 1.x

DOTNET_PACKAGES

The primary package cache. If not set, it defaults to $HOME/.nuget/packages on Unix or %userprofile%\.nuget\packages on Windows.

DOTNET_SERVICING

Specifies the location of the servicing index to use by the shared host when loading the runtime.

DOTNET_CLI_TELEMETRY_OPTOUT

Specifies whether data about the .NET Core tools usage is collected and sent to Microsoft. Set to true to opt-out of the telemetry feature (values true, 1, or yes accepted). Otherwise, set to false to opt into the telemetry features (values false, 0, or no accepted). If not set, the default is false and the telemetry feature is active.

   * * * * *

  See also

•   Runtime Configuration Files