The dotnet CLI creates, builds, tests, and runs .NET projects cross-platform—replacing Visual Studio-only workflows for many teams. The playground simulates a single-file console app; locally you use full SDK projects.
Essential commands
dotnet new console -n MyApp
cd MyApp
dotnet build
dotnet run
dotnet test
dotnet new list shows templates (classlib, web, xunit). dotnet --info prints installed SDKs and runtimes.
Project file basics
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
Important interview questions and answers
- Q: dotnet build vs run?
A:buildcompiles to IL inbin/;runbuilds if needed then executes with the appropriate runtime. - Q: SDK-style projects?
A: Concise MSBuild files with implicit usings and global.json for SDK pinning—standard since .NET Core 3+.
Self-check
- What command creates a console template?
- Where does build output land?
Tip: Run dotnet new list to see templates—dotnet new console, classlib, and xunit cover most local workflows.
Interview prep
- dotnet new vs dotnet build?
dotnet newscaffolds a project from a template;dotnet buildcompiles an existing project to IL.- dotnet run does what?
Builds if needed, then launches the application—convenient for local development loops.