Skip to content
Learn Netverks

Lesson

Step 12/36 33% through track

dotnet-cli

The dotnet CLI

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~1 min
Level
beginner

This lesson

This lesson teaches The dotnet CLI: the syntax, APIs, and habits you need before advancing in ASP.NET.

Teams ship The dotnet CLI on every ASP.NET codebase—skipping it leaves gaps in debugging and code reviews.

You will apply The dotnet CLI in contexts like: Line-of-business APIs, intranets, BFF layers, and cloud-hosted services on Linux or Windows.

Write C# (top-level or Program class), click Run on server—the dev runner uses dotnet build/run on a temp net8 project (requires .NET SDK; LEARNING_RUNNER_ENABLED=true).

When you can explain the previous lesson's ideas without copying starter code.

The dotnet CLI is your command-line interface to create, build, test, and publish .NET projects—like npm plus a compiler plus project templates in one tool.

Essential commands

  • dotnet --version — installed SDK version
  • dotnet new web -n MySite — MVC/Razor web app template
  • dotnet new webapi -n MyApi — Web API template
  • dotnet restore — fetch NuGet packages
  • dotnet build — compile
  • dotnet run — build and run (Kestrel starts)
  • dotnet watch run — hot reload during development
  • dotnet ef migrations add Initial — EF Core migrations (with tools installed)

Typical first project

dotnet new web -n Bookstore
cd Bookstore
dotnet run
# Browse https://localhost:5xxx

Important interview questions and answers

  1. Q: dotnet new vs Visual Studio?
    A: Same templates—CLI is CI-friendly and cross-platform; VS adds GUI and debuggers.
  2. Q: Where are templates defined?
    A: SDK ships default templates; install more with dotnet new install.

Self-check

  1. Which command starts the dev server after scaffolding?
  2. What does dotnet restore do?

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • dotnet new templates?
  • global.json when?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump