.NET › .NET CLI, SDK & Project Structure (csproj)
What is the dotnet CLI, and what are some of its most commonly used commands?
BeginnerAnswer
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.