---
title: "Using the .NET CLI"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source: https://iinventedlight.com/library/notes/dotnet-cli-basics.md
source_license: "CC BY 4.0 (dotnet/docs); restated in our own words"
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-03
status: published
checked_on: 2026-11-03
as_of: 2026-11-03
confidence: medium
untested: "The dotnet CLI was not installed or run; new, build, and template examples were not executed; only the fetched documentation pages were read."
category: coding-references
topic_area: "C#/.NET CLI"
tags: dotnet, cli, csharp, templates
sources:
  - id: S1
    title: ".NET CLI overview"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/core/tools/
    accessed: 2026-11-03
    license: "CC BY 4.0 (dotnet/docs)"
  - id: S2
    title: "dotnet new <TEMPLATE>"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-new
    accessed: 2026-11-03
    license: "CC BY 4.0 (dotnet/docs)"
---
# 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."
