dotnet(1)

πŸ“¦
version 11.0.0~rc3 Β· 6 versions
, in alpine 3.24, centos-stream 10, centos-stream 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

dotnet(1) πŸ’… .NET Documentation

okay bestie, grab a boba, we're doing this πŸ§‹βœ¨

This article applies to: βœ”οΈ .NET 6 SDK and later versions


✨ NAME ✨

dotnet β€” the generic driver for the .NET CLI. she's the main character, fr fr πŸ‘‘

✨ SYNOPSIS ✨

<h3>To get information about the available commands and the environment:</h3>

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

dotnet -h|--help

<h3>To run a command (requires SDK installation):</h3>

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

<h3>To run an application:</h3>

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

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

✨ DESCRIPTION ✨

so dotnet is literally doing two jobs at once and she's slaying both πŸ’–

  • She gives you commands for working with .NET projects.

Like, dotnet build builds a project. Every command defines its own options and arguments. And no cap β€” all commands support the --help option, which prints out brief documentation about how to use the command. 🫢

  • She runs .NET applications.

You give her the path to an application .dll file and she runs it. "To run the application" means to find and execute the entry point, which for console apps is the Main method. So for example, dotnet myapp.dll runs the myapp application. Want the tea on deployment? Go look at .NET application deployment to learn about deployment 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

These ones are available when dotnet is used by herself, without specifying a command or an application to run. Like dotnet --info or dotnet --version. They print out info about the environment. πŸ’«

  • --info β€” Prints out detailed information about a .NET installation and the machine environment, such as the current operating system, and commit SHA of the .NET version. receipts, basically 🧾
  • --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 [--arch <ARCH>] β€” Prints out a list of the installed .NET runtimes for the architecture of the invoked dotnet. An x86 version of dotnet lists only x86 runtimes, and an x64 version of dotnet lists only x64 runtimes.

.NET 10 and later versions support the --arch argument. If specified and not the same as the dotnet architecture, searches for a .NET installation of the specified architecture and prints out any runtimes installed there. Allowed values include arm64, x64, and x86. The dotnet/runtime repo has the full list of valid architecture values (https://github.com/dotnet/runtime/blob/1713d65316467e3eaf23514b6642eba5869f1b70/src/native/corehost/hostmisc/utils.cpp#L194-L205). πŸ“‹

  • --list-sdks [--arch <ARCH>] β€” Prints out a list of the installed .NET SDKs for the architecture of the invoked dotnet. An x86 version of dotnet lists only x86 SDKs, and an x64 version of dotnet lists only x64 SDKs.

.NET 10 and later versions support the --arch argument. If specified and not the same as the dotnet architecture, searches for a .NET installation of the specified architecture and prints out any SDKs installed there. Allowed values include arm64, x64, and x86. The dotnet/runtime repo has the full list of valid architecture values (https://github.com/dotnet/runtime/blob/1713d65316467e3eaf23514b6642eba5869f1b70/src/native/corehost/hostmisc/utils.cpp#L194-L205). πŸ“‹

  • -? | -h | --help β€” Prints out a list of available commands. the "what can u even do" button πŸŽ€

🌸 Options for running a command

These ones are for dotnet with a command. Like 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 option is available. iykyk, check first 🫣
  • -? | -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 available options. πŸ”–

🌸 Options for running an application

These ones 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-configuration-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. Intended 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 only 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.
⚠️ bestie listen β€” this option overrides the version of the first framework reference in the application's .runtimeconfig.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. do not ignore this one, I'm serious 😭

🌸 Options for running an application with the exec command

These ones 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 dependencies 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 typically named <applicationname>.runtimeconfig.json. For more information, see .NET runtime configuration settings. βš™οΈ

🌸 dotnet commands

πŸ’œ General

  • 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 online for the command.
  • 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 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

  • dotnet reference add β€” Adds a project reference.
  • dotnet reference list β€” Lists project references.
  • dotnet reference remove β€” Removes a project reference.

πŸ’œ NuGet packages

  • dotnet package add β€” Adds a NuGet package.
  • dotnet package list β€” Lists NuGet packages.
  • dotnet package remove β€” Removes a NuGet package.
  • dotnet package search β€” Searches for a NuGet package.

🌸 NuGet commands

the package-handling girlies, all of them, right here:

  • dotnet nuget delete β€” deletes a package from the server, or unlists it (yes babe, unlisting is a whole vibe)
  • dotnet nuget push β€” pushes your package up to the server and publishes it, no cap
  • dotnet nuget locals β€” clears or lists your local NuGet resources, like the http-request cache, the temporary cache, or the machine-wide global packages 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 every NuGet source you've configured
  • dotnet nuget remove source β€” removes a NuGet source
  • dotnet nuget update source β€” updates a NuGet source

πŸ¦‹ Workload commands

  • dotnet workload clean β€” removes workload components
  • dotnet workload config β€” enables or disables workload-set update mode
  • dotnet workload history β€” shows all the workload installation actions that happened
  • dotnet workload install β€” installs an optional workload
  • dotnet workload list β€” lists all installed workloads
  • dotnet workload repair β€” repairs all installed workloads
  • dotnet workload restore β€” restores the workloads a project needs
  • dotnet workload search β€” lists selected workloads, or all the available ones
  • dotnet workload uninstall β€” uninstalls a workload
  • dotnet workload update β€” reinstalls all installed workloads

πŸŽ€ Global, tool-path, and local tools commands

okay so tools are literally console applications that get installed from NuGet packages and then invoked straight from the command prompt. You can write your own tools or install tools that third parties wrote β€” both are valid, both are iconic. These are also known as global tools, tool-path tools, and local tools. Want the full lore? See the .NET tools overview.

  • dotnet tool install β€” installs a tool on your machine
  • dotnet tool list β€” lists all the global, tool-path, or local tools currently installed on your machine
  • dotnet tool search β€” searches NuGet.org for tools that have your specified search term in their name or metadata πŸ”
  • dotnet tool uninstall β€” uninstalls a tool from your machine
  • dotnet tool update β€” updates a tool that's installed on your machine

✨ Additional tools

The following additional tools ship as part of the .NET SDK:

  • dev-certs β€” creates and manages development certificates
  • 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 detects changes in the source code

For more info on any of these, just 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


and that's the whole page bestie, we ate and left no crumbs πŸ“βœ¨ this one's from the 2025-10-30 era of dotnet(1) β€” go forth, run your commands, and slay πŸ’–πŸ‘‘

πŸ“¦ where this page comes from