Provided by: dotnet-host-8.0_8.0.18-0ubuntu1~24.04.1_amd64 bug

dotnet command

       This article applies to: ✔️ .NET Core 3.1 SDK and later versions

NAME

       dotnet - The generic driver for the .NET CLI.

SYNOPSIS

       To get information about the available commands and the environment:

              dotnet [--version] [--info] [--list-runtimes] [--list-sdks]

              dotnet -h|--help

       To run a command (requires SDK installation):

              dotnet <COMMAND> [-d|--diagnostics] [-h|--help] [--verbosity <LEVEL>]
                  [command-options] [arguments]

       To run an application:

              dotnet [--additionalprobingpath <PATH>] [--additional-deps <PATH>]
                  [--fx-version <VERSION>]  [--roll-forward <SETTING>]
                  <PATH_TO_APPLICATION> [arguments]

              dotnet exec [--additionalprobingpath] [--additional-deps <PATH>]
                  [--depsfile <PATH>]
                  [--fx-version <VERSION>]  [--roll-forward <SETTING>]
                  [--runtimeconfig <PATH>]
                  <PATH_TO_APPLICATION> [arguments]

DESCRIPTION

       The dotnet command has two functions:

       • It provides commands for working with .NET projects.

         For  example,  dotnet build builds a project.  Each command defines its own options and arguments.  All
         commands support the --help option for printing out brief documentation about how to use the command.

       • It runs .NET applications.

         You specify the path to an application .dll file to run the application.  To run the application  means
         to  find  and execute the entry point, which in the case of console apps is the Main method.  For exam‐
         ple, dotnet myapp.dll runs the myapp application.  See .NET application deployment to learn  about  de‐
         ployment options.

OPTIONS

       Different options are available for:

       • Displaying information about the environment.

       • Running a command.

       • Running an application.

   Options for displaying environment information and available commands
       The following options are available when dotnet is used by itself, without specifying a command or an ap‐
       plication  to run.  For example, dotnet --info or dotnet --version.  They print out information about the
       environment.

       • --info

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

       • --version

       Prints out the version of the .NET SDK used by dotnet commands, which may be affected  by  a  global.json
       file.  Available only when the SDK is installed.

       • --list-runtimes

         Prints  out  a list of the installed .NET runtimes.  An x86 version of the SDK lists only x86 runtimes,
         and an x64 version of the SDK lists only x64 runtimes.

       • --list-sdks

         Prints out a list of the installed .NET SDKs.

       • -?|-h|--help

         Prints out a list of available commands.

   Options for running a command
       The following options are for dotnet with a command.  For example, dotnet build --help  or  dotnet  build
       --verbosity diagnostic.

       • -d|--diagnostics

         Enables diagnostic output.

       • -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  op‐
         tion is available.

       • -?|-h|--help

         Prints  out  documentation for a given command.  For example, dotnet build --help displays help for the
         build command.

       • command options

         Each command defines options specific to that command.  See specific command page for a list of  avail‐
         able options.

   Options for running an application
       The  following options are available when dotnet runs an application.  For example, dotnet --roll-forward
       Major myapp.dll.

       • --additionalprobingpath <PATH>

         Path containing probing policy and assemblies to probe.  Repeat the option to specify multiple paths.

       • --additional-deps <PATH>

         Path to an additional .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, see
         Runtime Configuration  Files  (https://github.com/dotnet/sdk/blob/main/documentation/specs/runtime-con‐
         figuration-file.md) on GitHub.

       • --roll-forward <SETTING>

         Controls  how  roll forward is applied to the app.  The SETTING can be one of the following values.  If
         not specified, Minor is the default.

         • LatestPatch - Roll forward to the highest patch version.  This disables minor version roll forward.

         • Minor - Roll forward to the lowest higher minor version, if requested minor version is  missing.   If
           the requested minor version is present, then the LatestPatch policy is used.

         • Major  -  Roll  forward  to lowest higher major version, and lowest minor version, if requested major
           version is missing.  If the requested major version is present, then the Minor policy is used.

         • LatestMinor - Roll forward to highest minor version, even if requested minor version is present.  In‐
           tended for component hosting scenarios.

         • LatestMajor - Roll forward to highest major and highest minor version, even  if  requested  major  is
           present.  Intended for component hosting scenarios.

         • Disable  -  Don’t  roll  forward.  Only bind to specified version.  This policy isn’t recommended for
           general use because it disables the ability to roll forward to the latest patches.  This value is on‐
           ly recommended for testing.

         With the exception of Disable, all settings will use the highest available patch version.

         Roll forward behavior can also be configured in a project file property, a runtime  configuration  file
         property, and an environment variable.  For more information, see Major-version runtime roll forward.

       • --fx-version <VERSION>

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

         This  option  overrides  the version of the first framework reference in the application’s .runtimecon‐
         fig.json file.  This means it only works as expected if there’s just one framework reference.   If  the
         application has more than one framework reference, using this option may cause errors.

   Options for running an application with the exec command
       The  following options are available only when dotnet runs an application by using the exec command.  For
       example, dotnet exec --runtimeconfig myapp.runtimeconfig.json myapp.dll.

       • --depsfile <PATH>

         Path to a deps.json file.  A deps.json file is a configuration file that contains information about de‐
         pendencies necessary to run the application.  This file is generated by the .NET SDK.

       • --runtimeconfig <PATH>

         Path to a runtimeconfig.json file.  A runtimeconfig.json file contains run-time settings and  is  typi‐
         cally named <applicationname>.runtimeconfig.json.  For more information, see .NET runtime configuration
         settings.

   dotnet commands
   General
       Command               Function
       ────────────────────────────────────────────────────────────
       dotnet build          Builds a .NET application.
       dotnet build-server   Interacts  with  servers started by a
                             build.
       dotnet clean          Clean build outputs.
       dotnet exec           Runs a .NET application.
       dotnet help           Shows more detailed documentation on‐
                             line 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  com‐
                             mand 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 sdk check      Shows  up-to-date status of installed
                             SDK and Runtime versions.
       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.

   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 push             Pushes a package to  the  server  and
                                     publishes it.
       dotnet nuget locals           Clears or lists local NuGet resources
                                     such as http-request cache, temporary
                                     cache,  or  machine-wide global pack‐
                                     ages folder.
       dotnet nuget add source       Adds a NuGet source.
       dotnet nuget disable source   Disables a NuGet source.
       dotnet nuget enable source    Enables a NuGet source.
       dotnet nuget list source      Lists all configured NuGet sources.
       dotnet nuget remove source    Removes a NuGet source.
       dotnet nuget update source    Updates a NuGet source.

   Workload commands
       Command                     Function
       ──────────────────────────────────────────────────────────────────
       dotnet workload install     Installs an optional workload.
       dotnet workload list        Lists all installed workloads.
       dotnet workload repair      Repairs all installed workloads.
       dotnet workload search      List selected workloads or all avail‐
                                   able workloads.
       dotnet workload uninstall   Uninstalls a workload.
       dotnet workload update      Reinstalls all installed workloads.

   Global, tool-path, and local tools commands
       Tools are console applications that are installed from NuGet packages and are invoked  from  the  command
       prompt.  You can write tools yourself or install tools written by third parties.  Tools are also known as
       global tools, tool-path tools, and local tools.  For more information, see .NET tools overview.

       Command                 Function
       ──────────────────────────────────────────────────────────────
       dotnet tool install     Installs a tool on your machine.
       dotnet tool list        Lists all global, tool-path, or local
                               tools currently installed on your ma‐
                               chine.
       dotnet tool search      Searches  NuGet.org  for  tools  that
                               have the  specified  search  term  in
                               their name or metadata.
       dotnet tool uninstall   Uninstalls a tool from your machine.
       dotnet tool update      Updates  a  tool that is installed on
                               your machine.

   Additional tools
       The following additional tools are available as part of the .NET SDK:

       Tool           Function
       ─────────────────────────────────────────────────────
       dev-certs      Creates and manages development  cer‐
                      tificates.
       ef             Entity  Framework  Core  command-line
                      tools.
       user-secrets   Manages development user secrets.
       watch          A file watcher that restarts  or  hot
                      reloads  an  application  when it de‐
                      tects changes in the source code.

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

EXAMPLES

       Create a new .NET console application:

              dotnet new console

       Build a project and its dependencies in a given directory:

              dotnet build

       Run an application:

              dotnet exec myapp.dll

              dotnet myapp.dll

SEE ALSO

       • Environment variables used by .NET SDK, .NET CLI, and .NET runtime

       • Runtime Configuration  Files  (https://github.com/dotnet/sdk/blob/main/documentation/specs/runtime-con‐
         figuration-file.md)

       • .NET runtime configuration settings

                                                   2023-10-25                                          dotnet(1)