Using the .NET CLI
Summary
The .NET CLI ships with the SDK. From a terminal it develops, builds, runs, and publishes apps. Every invocation is the dotnet driver, then either a path to a framework-dependent DLL or a command with arguments and options. dotnet new writes a project or other file from a template.
Driver, command, arguments
The overview applies to the .NET Core 3.1 SDK and later. dotnet my_app.dll runs the app when you are in its folder. dotnet build runs a command. The driver picks an SDK first. With no global.json, that is the latest SDK installed. Arguments go to the command: dotnet publish my_app.csproj publishes that project. Options do too: --output sets the publish folder. A short path shown in the docs is dotnet new console, then dotnet build --output ./build_output, then dotnet on the built DLL.
Default commands include new, build, publish, run, test, pack, clean, and watch. Further commands add packages, talk to NuGet, manage workloads, and install tools (console apps from NuGet). new, build, run, test, publish, and pack restore on their own. --no-restore disables that.
dotnet new
The new-command page applies to the .NET 6 SDK and later. The template engine writes the files. dotnet new list shows installed templates. The search subcommand looks on NuGet.org. dotnet new console -h is help for one template.
From the .NET 7 SDK, list, search, install, and uninstall are subcommands. --dry-run previews a create. --force overwrites existing files. --language accepts C#, F#, or VB when the template allows it; quote F# if the shell treats # specially. --name defaults to the current directory name. --framework writes a target framework moniker such as net6.0. --output defaults to the current directory. --no-update-check skips a template-package update check. Default templates are not checked that way from the .NET 6 SDK.
Examples on the page: dotnet new console for C#, the same template with --language "F#" for F#, dotnet new classlib with a framework and -o for a library in another directory, dotnet new mvc -au None, dotnet new xunit, and dotnet new globaljson to pin an SDK version in the current directory.
Claims
- id: C1 claim: The .NET CLI is a cross-platform toolchain, included with the SDK, for developing, building, running, and publishing applications. source: S1 evidence: "The .NET command-line interface (CLI) is a cross-platform toolchain for developing, building, running, and publishing .NET applications."
- id: C2 claim: Without a global.json file, the dotnet driver uses the latest installed SDK and then runs the command. source: S1 evidence: "If there's no global.json file, the latest version of the SDK available is used."
- id: C3 claim: Commands that need a restore, including new, build, run, test, publish, and pack, run restore implicitly. source: S2 evidence: "You don't have to run dotnet restore because it's run implicitly by all commands that require a restore to occur"
- id: C4 claim: dotnet new creates a project or other artifact by asking the template engine to write files from a template. source: S2 evidence: "The dotnet new command creates a .NET project or other artifacts based on a template."
- id: C5 claim: dotnet new list shows the templates that are already installed on the machine. source: S2 evidence: "You can run dotnet new list to see a list of all installed templates."
- id: C6 claim: If you omit the output name, dotnet new uses the name of the current directory. source: S2 evidence: "If no name is specified, the name of the current directory is used."
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn, .NET CLI overview, CC BY 4.0 (dotnet/docs); Microsoft Learn, dotnet new <TEMPLATE>, CC BY 4.0 (dotnet/docs).
Cite this
iinventedlight. 2026. "Using the .NET CLI." iinventedlight Library, iil:note:39nknn6w, version of 2026-11-03. https://iinventedlight.com/library/notes/dotnet-cli-basics/. License: CC-BY-4.0.
@misc{iil_note_39nknn6w,
author = {{iinventedlight}},
title = {{Using the .NET CLI}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-03},
url = {https://iinventedlight.com/library/notes/dotnet-cli-basics/},
note = {Permanent ID iil:note:39nknn6w. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/dotnet-cli-basics.md.