Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

.NET CLI overview

Feedback

In this article

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

The .NET command-line interface (CLI) is a cross-platform toolchain for developing, building, running, and publishing .NET applications.

The .NET CLI is included with the.NET SDK. For more information about how to install the .NET SDK, seeInstall .NET. After installing the SDK, you can run CLI commands by opening a terminal and entering the commands at the terminal prompt.

Command structure

CLI command structure consists ofthe driver ("dotnet"),the command, and possibly commandarguments andoptions. You see this pattern in most CLI operations, such as creating a new console app, and running it from the command line. The following commands show when the console app was run from a directory namedmy_app:

dotnet new consoledotnet build --output ./build_outputdotnet ./build_output/my_app.dll

Driver

The driver is nameddotnet and has two responsibilities, either running aframework-dependent app or executing a command.

To run a framework-dependent app, specify the path to the app's .dll file after the driver without specifying a command, for example,dotnet /path/to/my_app.dll. When executing the command from the folder where the app's DLL resides, just executedotnet my_app.dll. For more information, see thedotnet command.

When you supply a command to the driver,dotnet.exe starts the CLI command execution process. For example:

dotnet build

First, the driver determines the version of the SDK to use. If there's noglobal.json file, the latest version of the SDK available is used. After the SDK version is determined, it executes the command.

Command

The command performs an action. For example,dotnet build builds code.dotnet publish publishes code. See theCLI commands section for a list of commands.

Arguments

The arguments you pass on the command line are the arguments to the command invoked or to options specified with the command. For example, when you executedotnet publish my_app.csproj, themy_app.csproj argument indicates the project to publish and is passed to thepublish command.

Options

The options you pass on the command line are the options to the command invoked. For example, when you executedotnet publish --output /build_output, the--output option and its value provided by the/build_output argument are passed to thepublish command.

CLI commands

The following commands are installed by default:

Basic commands

Project modification commands

NuGet commands

Workload management commands

Advanced commands

Tool management 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.

See also

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?