What is the dotnet CLI, and what are some of its most commonly used commands?
Short answer
The dotnet CLI is the cross-platform command-line interface for creating, building, running, testing, and publishing .NET projects.
Advertisement
AModel answer
The dotnet CLI is the cross-platform command-line interface for creating, building, running, testing, and publishing .NET projects. Common commands include `dotnet new` (scaffold a project), `dotnet build`, `dotnet run`, `dotnet test`, `dotnet publish`, `dotnet add package`, and `dotnet restore`.
dotnet new webapi -n MyApi
cd MyApi
dotnet restore
dotnet build
dotnet runReal-world example
A developer onboarding to a new project runs `dotnet restore && dotnet build && dotnet test` as a single sequence to verify their environment is set up correctly before writing any code.
Likely follow-ups
- How does dotnet new differ from Visual Studio's project wizard?
- What does dotnet restore actually do under the hood?
Related topics