Watch the video
Prefer reading? Below is a clear breakdown of which SDK tools the dotnet CLI uses under the hood, sample commands and publish options — copied and explained from the video for quick reference.
dotnet commands — internal SDK tools
Which commands need the SDK, and which run on the runtime only? The table below shows the primary internal tool invoked and the purpose.
| Command | Requires SDK or Runtime | Internal SDK Tool Used | Purpose |
|---|---|---|---|
dotnet new console |
SDK | Template engine (Microsoft.TemplateEngine.Cli) |
Creates a new project from a template. |
dotnet restore |
SDK | NuGet client (NuGet.Build.Tasks) |
Restores NuGet package dependencies. |
dotnet build |
SDK | MSBuild (Microsoft.Build.dll) + Roslyn (csc.dll) |
Compiles C# to IL and builds the project. |
dotnet run |
SDK | Combines build + runtime host |
Builds (if needed) and runs your app immediately. |
dotnet publish |
SDK | MSBuild + ILLinker + packaging tools | Builds, trims/optimizes, and gathers files for deployment. |
dotnet test |
SDK | VSTest (vstest.console.dll) |
Runs unit tests in a test project. |
dotnet pack |
SDK | NuGet packer (NuGet.Build.Tasks.Pack) |
Creates a NuGet package (.nupkg). |
dotnet tool install |
SDK | Tool installer | Installs global or local .NET tools. |
dotnet MyApp.dll |
Runtime only | Runtime host (dotnet.exe + CoreCLR) |
Runs an already built managed assembly (IL). |
Quick commands & publish options
Quick reference commands you can copy-paste into your terminal.
// check dotnet SDK version
dotnet --version
// create a folder, new console project
mkdir MyProject
cd MyProject
dotnet new console
// build and run
dotnet build
dotnet run
// run a built assembly directly (runtime host)
dotnet MyProject.dll
Publish examples:
// publish self-contained for Windows x64 (bundles the runtime)
dotnet publish -c Release -r win-x64 --self-contained true
// single-file + self-contained
dotnet publish -r win-x64 -c Release --self-contained true /p:PublishSingleFile=true
// native AOT (true native exe) — requires C++ build tools and Windows SDK
dotnet publish -r win-x64 -c Release --self-contained true /p:PublishAot=true
// single-file + native AOT
dotnet publish -r win-x64 -c Release --self-contained true /p:PublishAot=true /p:PublishSingleFile=true
If you see a Platform linker not found / AOT error, install the Desktop development with C++ workload in Visual Studio and ensure MSVC build tools + Windows SDK are present.
Want personalised help?
I teach 1-on-1 .NET (C#, ASP.NET Core, Blazor, APIs, SQL Server) — hands-on, fundamentals-first, interview-ready training.
Contact on WhatsApp